From fritchie@REDACTED Wed May 1 06:35:37 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Tue, 30 Apr 2002 23:35:37 -0500 Subject: Was {ram_file, true} option to dets:open_file() once a good idea? Message-ID: <200205010435.g414Zb874003@snookles.snookles.com> Reading the docs for dets, I see this in the discussion of dets:open_file/2: {ram_file, bool()}, whether the table is to be kept in RAM. Keeping the table in RAM may sound like an anomaly, but can enhance the performance of applications which open a table, insert a set of objects, and then close the table. When the table is closed, its contents are written to the disk file. The default value is false. However, when I use it to simply insert a bunch of tuples into a dets table, the result is about twice as slow (if not even worse) as if I omit it/set it to false. Was this option a good idea once upon a time? On my 500MHz Pentium III laptop, adding 800,000 tuples with {ram_file, false} takes 3 minutes. I aborted adding 500,000 tuples with {ram_file, true} after 7 min 30 seconds. Perhaps it's a good option to use when the file system is on a floppy disk or a *really* busy hard drive circa 1990? -Scott --- % Timed via: time erl -run test dets {N} true|false -run erlang halt -module(test). -export([dets/1, dets/2]). dets([S, RamFile]) -> % erl -run test dets N true|false dets(list_to_integer(S), list_to_atom(RamFile)). dets(N, RamFile) -> io:format("dets starting inserting ~w objects\n", [N]), T = dets_test, file:delete(atom_to_list(T)), {ok, T} = dets:open_file(T, [ {estimated_no_objects, N}, {ram_file, RamFile} ]), dets_insert(T, N), ok = dets:close(T), io:format("dets done inserting ~w objects\n", [N]), ok. dets_insert(T, 0) -> ok; dets_insert(T, X) -> K = <>, X2 = X * 2, V = <>, ok = dets:insert(T, [{K, V}]), dets_insert(T, X - 1). From harley@REDACTED Wed May 1 09:00:44 2002 From: harley@REDACTED (Harley Gorrell) Date: Wed, 1 May 2002 03:00:44 -0400 (EDT) Subject: Debugging inter-node spawning... Message-ID: Humm... I know this must be covered somewhere but I cant seem to find it in my book ('concurrent programming in erlang') or on the web. Spawning on the node works just fine. What should I look at to figure out what is wrong? Here is a summary of what I think should work, but does not. Window1 ---------- $erl -sname echosvr Erlang (BEAM) emulator version 5.0.2.4 [source] Eshell V5.0.2.4 (abort with ^G) (echosvr@REDACTED)1> Window2 ---------- $erl -sname echoclient Erlang (BEAM) emulator version 5.0.2.4 [source] Eshell V5.0.2.4 (abort with ^G) (foo1@REDACTED)1> nodes(). [] (foo1@REDACTED)2> spawn(echosvr,io,format,["echo"]). <0.36.0> =ERROR REPORT==== 30-Apr-2002::23:38:44 === ** Can not start io:format,[[101,99,104,111]] on echosvr ** (foo1@REDACTED)3> spawn_link(io,format,["echo"]). echo<0.38.0> -------------------- So what have I missed?, harley. From lennart.ohman@REDACTED Wed May 1 17:56:16 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Wed, 01 May 2002 17:56:16 +0200 Subject: Debugging inter-node spawning... References: Message-ID: <3CD01020.345964C9@st.se> Hi, I see one and can think of also one other problem in your example. 1) Have you set the cookies? Try erlang:set_cookie(node(),myfavoritecookie). on both nodes. 2) > (foo1@REDACTED)2> spawn(echosvr,io,format,["echo"]). echosvr is not a complete node name. Try the atom 'echosvr@REDACTED' instead. Happy programming! /Lennart Harley Gorrell wrote: > > Humm... I know this must be covered somewhere but I cant > seem to find it in my book ('concurrent programming in > erlang') or on the web. Spawning on the node works just > fine. What should I look at to figure out what is wrong? > > Here is a summary of what I think should work, but does not. > > Window1 ---------- > > $erl -sname echosvr > Erlang (BEAM) emulator version 5.0.2.4 [source] > > Eshell V5.0.2.4 (abort with ^G) > (echosvr@REDACTED)1> > > Window2 ---------- > > $erl -sname echoclient > Erlang (BEAM) emulator version 5.0.2.4 [source] > > Eshell V5.0.2.4 (abort with ^G) > (foo1@REDACTED)1> nodes(). > [] > (foo1@REDACTED)2> spawn(echosvr,io,format,["echo"]). > <0.36.0> > > =ERROR REPORT==== 30-Apr-2002::23:38:44 === > ** Can not start io:format,[[101,99,104,111]] on echosvr ** > (foo1@REDACTED)3> spawn_link(io,format,["echo"]). > echo<0.38.0> > > -------------------- > > So what have I missed?, > harley. -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From harley@REDACTED Wed May 1 19:37:20 2002 From: harley@REDACTED (Harley Gorrell) Date: Wed, 1 May 2002 13:37:20 -0400 (EDT) Subject: Debugging inter-node spawning... In-Reply-To: Message-ID: On Wed, 1 May 2002, Harley Gorrell wrote: > Spawning on the node works just fine. What should I look > at to figure out what is wrong? I received two replies, to this note which also went to this list. Thanks Andreas and Lennart! After reading them, I checked again that the cookie was correct (is was) and tried out the 'net_adm:ping' function which I hadnt known about. With ping I could then see a non-null list from nodes(). So I knew erlang was setup ok. After a bit more tinkering, I found that the call was indeed making the round trip, but the output of 'io:format' was appearing on the console of the spawning node. I was thinking that the output would appear on the remote node. Here is an example. 'echo:hi/1' is loaded on 'foo2@REDACTED' with 'c(echo)'. From a new erl, I spawn the function and the output appears locally. -------------------- $erl -sname foo1 Erlang (BEAM) emulator version 5.1 [source] Eshell V5.1 (abort with ^G) (foo1@REDACTED)1> spawn(foo2@REDACTED,echo,hi,[foo2]). hi2 'foo2' <38.48.0> (foo1@REDACTED)2> -------------------- Moral: 'io:format' is not 'printf'. thanks everyone, harley. From per@REDACTED Thu May 2 09:03:38 2002 From: per@REDACTED (Per Bergqvist) Date: Thu, 02 May 2002 08:03:38 +0100 Subject: Debugging inter-node spawning... In-Reply-To: Message-ID: <200205020603.g4263c009800@vargen.levonline.com> Hi Harley, No, io:format is not printf. If you check io:format/3 it takes an i/o device pid as the first argument. If the argument is omitted io:format will use the group leader. To do output on the remote node do either: a) RP = rpc:call(per@REDACTED,erlang,list_to_pid,["<0.0.0>"]), io:format(RP,"Hello World !\n",[]). b) LP = erlang:group_leader(), RP = rpc:call(per@REDACTED,erlang,list_to_pid,["<0.0.0>"]), erlang:group_leader(RP,self()), io:format("Hello World !\n"), erlang:group_leader(LP,self()). To do low level output use erlang:display. /Per > On Wed, 1 May 2002, Harley Gorrell wrote: > > Spawning on the node works just fine. What should I look > > at to figure out what is wrong? > > I received two replies, to this note which also went to > this list. Thanks Andreas and Lennart! > > After reading them, I checked again that the cookie was > correct (is was) and tried out the 'net_adm:ping' function > which I hadnt known about. With ping I could then see a > non-null list from nodes(). So I knew erlang was setup ok. > > After a bit more tinkering, I found that the call was > indeed making the round trip, but the output of 'io:format' > was appearing on the console of the spawning node. I was > thinking that the output would appear on the remote node. > > Here is an example. 'echo:hi/1' is loaded on 'foo2@REDACTED' > with 'c(echo)'. From a new erl, I spawn the function and > the output appears locally. > > -------------------- > > $erl -sname foo1 > Erlang (BEAM) emulator version 5.1 [source] > > Eshell V5.1 (abort with ^G) > (foo1@REDACTED)1> spawn(foo2@REDACTED,echo,hi,[foo2]). > hi2 'foo2' > <38.48.0> > (foo1@REDACTED)2> > > -------------------- > > Moral: 'io:format' is not 'printf'. > > thanks everyone, > harley. > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From vlad_dumitrescu@REDACTED Thu May 2 10:01:41 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 02 May 2002 10:01:41 +0200 Subject: Shock horror Message-ID: > a) Things may load slowly > b) It becomes increasingly difficult to ship stand-alone > applications since nobody is really sure of what code is needed. > > A consequence of c) is the *ship everything* mentality. > > I'm going to take a good hard look at the system to see if we can't >identify a minimal kernel ... Hi, If I may add my humble opinion, this is why having a "-uses([module])." or similar would help - by making the relations between modules explicit. This might even encompass applys with variable arguments - only calls to listed modules will be allowed. I think that not shipping everything is not necessarily good - what if one later loads new code that relies upon some less used stdlib module? One should have then to keep track of what was delivered where, and it is difficult in the long run even for such hard constrained environments as Ericsson's. Also, what if an operator might be allowed to access the Erlang shell - he/she wouldn't have access to the absent functionality... However, should one be sure that the code base is fixed or the whole system will be upgraded, then it is also possible to have an additional step after the compilation, where all unused modules (maybe even functions) can be removed from the delivery. Of course, this is not trivial without things like "-uses([module])." or "-uses([mod:fun/x]).". just some thoughts. Regards, Vlad _________________________________________________________________ Skicka och ta emot Hotmail-meddelanden p? din mobilenhet: http://mobile.msn.com From enano@REDACTED Thu May 2 10:12:10 2002 From: enano@REDACTED (Miguel Barreiro Paz) Date: Thu, 2 May 2002 10:12:10 +0200 (CEST) Subject: Shock horror In-Reply-To: Message-ID: > If I may add my humble opinion, this is why having a "-uses([module])." or > similar would help - by making the relations between modules explicit. This > might even encompass applys with variable arguments - only calls to listed > modules will be allowed. What about "fun(M,F) -> M:F(myargs)"-style code then? ok, one can think of not providing a "-uses()" header as "heck, who knows what it uses, allow everything", but it's a bit like the current -compile(export_all): a hack frowned upon. Regards, Miguel From vlad_dumitrescu@REDACTED Thu May 2 10:28:14 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 02 May 2002 10:28:14 +0200 Subject: Shock horror Message-ID: > > If I may add my humble opinion, this is why having a "-uses([module])." >or > > similar would help - by making the relations between modules explicit. >This > > might even encompass applys with variable arguments - only calls to >listed > > modules will be allowed. > > What about "fun(M,F) -> M:F(myargs)"-style code then? ok, one can >think of not providing a "-uses()" header as "heck, who knows what it >uses, allow everything", but it's a bit like the current >-compile(export_all): a hack frowned upon. I know there are problems with my idea. But in most cases, the allowable M:F combinations are limited. It really might be anything only for the shell and other similar apps, where the input might indeed be anything. But then it would be perfectly all right to allow everything! Of course, no one can stop someone from using export_all, or in this case to declare use of any module, but there is a balance between ease of development (make it work first without thinking of compilation details) and ease of delivery (do not ship more stuff than is needed) and maintainance (know what a change will affect in the system). I haven't either been thinking about how easy to use and implement such a feature might be, just got the idea and started the brainstorming! :-) regards, Vlad _________________________________________________________________ Kom med i v?rldens st?rsta e-posttj?nst med MSN Hotmail. http://www.hotmail.com From richardc@REDACTED Thu May 2 10:41:34 2002 From: richardc@REDACTED (Richard Carlsson) Date: Thu, 2 May 2002 10:41:34 +0200 (MET DST) Subject: Shock horror In-Reply-To: Message-ID: On Thu, 2 May 2002, Vlad Dumitrescu wrote: > If I may add my humble opinion, this is why having a > "-uses([module])." or similar would help - by making the relations > between modules explicit. This might even encompass applys with > variable arguments - only calls to listed modules will be allowed. Then the gen_... modules, and any others using callbacks, would not be possible if this was strictly enforced. Furthermore, that kind of declaration has an inherent problem: they tend to be always outdated. For instance, you specify that M uses M', but then later someone edits M so that it no longer actually uses M', and forgets to remove the declaration. The information is already there: you don't need a -uses declaration just to duplicate it, with all the trouble that brings. Someone please write a decent front end to xref that reports the module dependencies (or writes them to a file) so that you don't have to look up the xref manual each time, and put it in the standard distribution. Erlang is a very dynamic language - let's not clutter it with unnecessary static declarations. > I think that not shipping everything is not necessarily good - what > if one later loads new code that relies upon some less used stdlib > module? One should have then to keep track of what was delivered > where, and it is difficult in the long run even for such hard > constrained environments as Ericsson's. Also, what if an operator > might be allowed to access the Erlang shell - he/she wouldn't have > access to the absent functionality... I think what we need is a reasonable layering of the libraries, not a fine-grained "is this module strictly necessary?" approach. So for a standalone application, only the most basic runtime libraries and a few libraries used specifically by the application would be needed (and maybe stripped to the bare bones before shipping, as suggested). For a small distribution which normally starts a shell, most of the standard libraries should be available, but probably not things like ASN1, Corba, (Java support?), Megaco, and other things; these can be installed separately if needed. A "telco toolkit" distribution would include all the snmp/asn1/godonlyknows stuff. And so on. It's a question of identifying the layers and doing some restructuring, mainly of the kernel/stdlib modules. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From francesco@REDACTED Thu May 2 10:52:12 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 02 May 2002 09:52:12 +0100 Subject: Shock horror References: Message-ID: <3CD0FE3C.9090904@erlang-consulting.com> Vlad wrote: > One should have then to keep track of what was delivered where, and it > is difficult in the long run even for such hard constrained > environments as Ericsson's. It is difficult, but it has to be done. If you have hundreds of systems installed worldwide, with maybe 5 versions available and 10 patch packages for each version, knowing *Exactly* what module versions, what patches, what application versions and release revisions is indispensable, as you need to recreate the exact environmentso as to know what code to debug and *hopefully* be able to reproduce the problem in a controlled environment. There are cases where we spent days chasing problems which in the end appeared to be undocumented hand installed patches by some overambitious engineer who did not know what he was doing. > Also, what if an operator might be allowed to access the Erlang shell > - he/she wouldn't have access to the absent functionality. I am ready to debate if we even should give access to the Erlang shell to first and second line support. A few years ago, I never believed I would say such a thing, but with literaly thousands of heavy duty Erlang systems running out there today, if you are to stand any chance of giving decent support and efficiently finding bugs giving operators an Erlang shell would not facilitete your task as you can not control or monitor what they have done.. Regards, Francsesco - http://www.erlang-consulting.com From vlad_dumitrescu@REDACTED Thu May 2 11:03:39 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 02 May 2002 11:03:39 +0200 Subject: Shock horror Message-ID: >From: Richard Carlsson >Then the gen_... modules, and any others using callbacks, would not be >possible if this was strictly enforced. They would be allowed to have a "uses(all)" declaration. >Furthermore, that kind of >declaration has an inherent problem: they tend to be always outdated. True, but then we have the same kind of problem with the documentation. The compiler should do some work to ensure things are ok, the same thing as for -export(). >The information is already there: you don't need a -uses declaration >just to duplicate it, with all the trouble that brings. Mmm, yes and no. Usually, yes, the information is there. But then it isn't dynamic, is it? The dynamism comes from apply(Mod, Fun) - which xref can't analyze either. I don't say this is the best solution, but I feel a simpler way than today's xref to obtain a broader view of the system would be useful. The declarations would cache xref's analysis - maybe xref could even update those when run! >I think what we need is a reasonable layering of the libraries, not a >fine-grained "is this module strictly necessary?" approach. Looks like a great idea! Maybe your new module system might help this? /Vlad _________________________________________________________________ Skicka och ta emot Hotmail-meddelanden p? din mobilenhet: http://mobile.msn.com From vlad_dumitrescu@REDACTED Thu May 2 11:10:31 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 02 May 2002 11:10:31 +0200 Subject: Shock horror Message-ID: >From: Francesco Cesarini >Vlad wrote: >>One should have then to keep track of what was delivered where, and it is >>difficult in the long run even for such hard constrained >>environments as Ericsson's. >It is difficult, but it has to be done. If you have hundreds of systems >installed worldwide, with maybe 5 versions available and 10 patch >packages for each version, knowing *Exactly* what module versions, what >patches, what application versions and release revisions is >indispensable I know, this is what I do nowadays myself :-) What I meant is that for example the open-source version has no chance at all to do that kind of management. It must be contain everything. regards, Vlad _________________________________________________________________ Kom med i v?rldens st?rsta e-posttj?nst med MSN Hotmail. http://www.hotmail.com From enano@REDACTED Thu May 2 11:22:48 2002 From: enano@REDACTED (Miguel Barreiro Paz) Date: Thu, 2 May 2002 11:22:48 +0200 (CEST) Subject: Shock horror In-Reply-To: Message-ID: > > I haven't either been thinking about how easy to use and implement such a > feature might be, just got the idea and started the brainstorming! :-) A good thing indeed :) From Sean.Hinde@REDACTED Thu May 2 12:26:51 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 2 May 2002 11:26:51 +0100 Subject: Shock horror Message-ID: <402DD461F109D411977E0008C791C312039F6AC0@imp02mbx.one2one.co.uk> > I am ready to debate if we even should give access to the > Erlang shell > to first and second line support. A few years ago, I never > believed I > would say such a thing, but with literaly thousands of heavy > duty Erlang > systems running out there today, if you are to stand any chance of > giving decent support and efficiently finding bugs giving > operators an > Erlang shell would not facilitete your task as you can not control or > monitor what they have done.. We do give access to first line application support and they tend not to mess things up. It does save me getting called at midnight for the most part (3 times in 3 years is not too bad - only once for an actual Erlang problem - SNMP failing to startup cleanly in an older version). We don't give it to other support teams around the business, which means we have to do web gui stuff for all sorts of stuff it would be nice to provide a command line i/f to. What would be ideal would be a telnet interface into the runtime with proper logins and configurable levels of access. e.g. login shinde would only be allowed to call count:get_stats(). and vsn:get_versions(). and not allowed to send messages. Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From hal@REDACTED Thu May 2 16:34:07 2002 From: hal@REDACTED (Hal Snyder) Date: 02 May 2002 09:34:07 -0500 Subject: Shock horror In-Reply-To: <402DD461F109D411977E0008C791C312039F6AC0@imp02mbx.one2one.co.uk> (Sean Hinde's message of "Thu, 2 May 2002 11:26:51 +0100") References: <402DD461F109D411977E0008C791C312039F6AC0@imp02mbx.one2one.co.uk> Message-ID: <874rhqr540.fsf@gamera.vail> Sean Hinde writes: > What would be ideal would be a telnet interface into the runtime > with proper logins and configurable levels of access. e.g. login > shinde would only be allowed to call count:get_stats(). and > vsn:get_versions(). and not allowed to send messages. Right. We do this sort of thing with our C++ based SIP services and it works very well for ops staff. What might be useful is a generic (a la inets) resource for setting up a telnet-like server with configurable authorization levels (thinking of IOS/Zebra "user" vs "enable" modes), command sets and callbacks, readline-style command history. From mpeti_k02@REDACTED Thu May 2 21:37:51 2002 From: mpeti_k02@REDACTED (laurent mpeti kabila) Date: Thu, 2 May 2002 21:37:51 +0200 Subject: No subject Message-ID: <200205021932.g42JW1j12494@hades.cslab.ericsson.net> REQUEST FOR URGENT BUSINESS ASSISTANCE -------------------------------------- Your contact was availed to me by the chamber of commerce. It was given to me because of my diplomatic status as I did not disclose the actual reasons for which I sought your contact. But I was assured That you are reputable and trustworthy if you will be of assistance. I am Laurent Mpeti Kabila (Jnr) the second son of Late President LAURENT DESIRE KABILA the immediate Past president of the DEMOCRATIC REPUBLIC OF CONGO in Africa who was murdered by his opposition through his personal bodyguards in his bedroom on Tuesday 16th January, 2001. I have the privilege of being mandated by my father colleagues to seek your immediate and urgent co-operation to receive into your bank account the sum of US $25m. (twenty-five million Dollars) and some thousands carats of Diamond. This money and treasures was lodged in a vault with a security firm in Europe and South-Africa. SOURCES OF DIAMONDS AND FUND In August 2000, my father as a defence minister and president has a meeting with his cabinet and armychief about the defence budget for 2000 to 2001 which was US $700m. so he directed one of his best friend. Frederic Kibasa Maliba who was a minister of mines and a political party leader known as the Union Sacree de, I opposition radicale et ses allies (USORAL) to buy arms with US $200m on 5th January 2001; for him to finalized the arms deal, my father was murdered. f.K. Maliba (FKM) and I have decided to keep the money with a foreigner after which he will use it to contest for the political election. Inspite of all this we have resolved to present your or your company for the firm to pay it into your nominated account the above sum and diamonds. This transaction should be finalized within seven (7) working days and for your co-operation and partnership, we have unanimously agreed that you will be entitled to 5.5% of the money when successfully receive it in your account. The nature of your business is not relevant to the successful execution of this transaction what we require is your total co-operation and commitment to ensure 100% risk-free transaction at both ends and to protect the persons involved in this transactio! n, strict confidence and utmost secrecy is required even after the successful conclusion of this transaction. If this proposal is acceptable to you, kindly provide me with your personal telephone and fax through my E-mail box for immediate commencement of the transaction. I count on your honour to keep my secret, SECRET. Looking forward for your urgent reply Thanks. Best Regards MPETI L. KABILA (Jnr) From sondage020502@REDACTED Fri May 3 01:38:35 2002 From: sondage020502@REDACTED (SondageExpress) Date: Fri, 3 May 2002 01:38:35 +0200 Subject: =?iso-8859-1?Q?Le_dernier_sondage_avant_les_=E9l=E9ctions_pr=E9sidentielles_2002_!?= Message-ID: <289722002542233835469@ifrance.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: From Laszlo.Varga@REDACTED Fri May 3 10:53:45 2002 From: Laszlo.Varga@REDACTED (Laszlo Varga) Date: Fri, 3 May 2002 10:53:45 +0200 (MEST) Subject: radix sorting Message-ID: <200205030853.g438rjC01328@duna273.eth.ericsson.se> Hi! I've just bumped into this exiting sorting method, and started thinking that how much would this fit Erlang. Some questions: Is this technique used elsewhere in erlang systems, and if it is, then implemented in pure erlang or in lower level (C??). Does it make sense (apart from playing around) implement sortings in erlang, or the libraries cannot be beaten by erlang code? Radix sorting seems to be most of time applied for lexicographic sorting. Are there erlang support for this? Are there methods for sorting by compound keys? Thanks laszlo From vlad_dumitrescu@REDACTED Fri May 3 12:35:23 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 03 May 2002 12:35:23 +0200 Subject: erl_lint bug Message-ID: Hi, I noticed that erl_lint does wrongly report variables as unused if they only appear as a generator in a list comprehension. For example, fun(X) -> [H || H <- X]. reports X as unused. I would have loved to be able to send a patch, but these parts of the system I haven't yet gathered the courage to dig in ;-) regards, Vlad _________________________________________________________________ Chatta med kompisar online, prova MSN Messenger: http://messenger.msn.com From ralf@REDACTED Fri May 3 15:01:42 2002 From: ralf@REDACTED (Ralf Hinze) Date: Fri, 3 May 2002 15:01:42 +0200 Subject: CFP: JFP Special Issue on Functional Pearls Message-ID: <200205031501.42520.ralf@informatik.uni-bonn.de> Apologies if you receive multiple copies... ============================================================================ CALL FOR PAPERS Special Issue on Functional Pearls http://www.informatik.uni-bonn.de/~ralf/necklace.html [Deadline: 31 August 2002] ============================================================================ Wer die Perle in H?nden h?lt, fragt nicht nach der Muschel. - Peter Benary A special issue of the Journal of Functional Programming will be devoted to Functional Pearls. The submission deadline is 31 August 2002. Scope ----- Do you have a paper that is small, rounded and enjoyable to read? Please consider submitting it to the Special Issue on Functional Pearls, as we intend to string a shiny necklace. If you don't have a pearl, write one today! Papers can be on any subject connected to functional programming. A pearl is typically around 8 pages, though there is no strict page limit. The special issue also welcomes tutorial or educational papers in a broad sense. Submission details ------------------ Manuscripts should be unpublished works and not submitted elsewhere. Revised and polished versions of papers published in conference proceedings that have not appeared in archival journals are eligible for submission. All submissions will be reviewed according to the usual standards of scholarship and judged by elegance of development and clarity of expression. One of the main reviewers will be Richard Bird, the editor of JFP's regular Functional Pearls column. Deadline for submission: 31 August 2002 Notification of acceptance or rejection: 30 November 2002 Revised version due: 31 January 2003 Submissions should be sent to the Guest Editor (see address below), with a copy to Nasreen Ahmad (nasreen@REDACTED). Submitted articles should be sent in PDF or Postscript format, preferably gzipped and uuencoded. The use of the JFP style files is strongly recommended. In addition, please send, as plain text, title, abstract (if any), and contact information. The submission deadline is 31 August 2002. Authors will be notified of acceptance or rejection by 30 November 2002. Revised versions are due on 31 January 2003. For other submission details, please consult an issue of the Journal of Functional Programming or see the Journal's web page at http://www.dcs.gla.ac.uk/jfp/. Guest Editor ------------ Ralf Hinze Institut f?r Informatik III Universit?t Bonn R?merstra?e 164 53117 Bonn, Germany Telephone: +49 (2 28) 73 - 45 35 Fax: +49 (2 28) 73 - 43 82 Email: ralf@REDACTED WWW: http://www.informatik.uni-bonn.de/~ralf/ ============================================================================ From bjorn@REDACTED Fri May 3 15:06:26 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 03 May 2002 15:06:26 +0200 Subject: erl_lint bug In-Reply-To: "Vlad Dumitrescu"'s message of "Fri, 03 May 2002 12:35:23 +0200" References: Message-ID: Thanks! We are aware of the problem, and we will fix it in R9. Despite this little problem, I find the warn_unused_vars option to be usable and worth turning on. So far I have found one minor bug and several cases of unnecessary code and unused function arguments in my code (in both OTP code and Wings code). When writing new code, the warnings helped me to find typos quicker than the usual method of staring at the suspect code sequence. /Bjorn "Vlad Dumitrescu" writes: > Hi, > > I noticed that erl_lint does wrongly report variables as unused if they only > appear as a generator in a list comprehension. For example, > > fun(X) -> [H || H <- X]. > > reports X as unused. > > I would have loved to be able to send a patch, but these parts of the system > I haven't yet gathered the courage to dig in ;-) > > regards, > Vlad > > > _________________________________________________________________ > Chatta med kompisar online, prova MSN Messenger: http://messenger.msn.com > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From Bruce@REDACTED Sat May 4 02:28:19 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Sat, 4 May 2002 12:28:19 +1200 Subject: now() and arithmetic References: Message-ID: <0d1301c1f302$97669090$dc21970a@norris> Hello, Does anyone have some prebuilt routines for manipulating now() tuples, or for converting them into C style seconds-since-blah values? Alternatively can someone tell me the max size of the MicroS/S/MegaS integers, so I can tell when it should overflow from one to the other (and then I'll build some routines)? I could use date/time tuples, but I'm only interested in differences most of the time. I'm building some replacement aplio voip phone servers (similar to H.323 Gatekeeper, but proprietary), and I want to age calls. Thanks a lot in advance, Bruce From matthias@REDACTED Sat May 4 12:32:24 2002 From: matthias@REDACTED (Matthias Lang) Date: Sat, 4 May 2002 12:32:24 +0200 Subject: now() and arithmetic In-Reply-To: <0d1301c1f302$97669090$dc21970a@norris> References: <0d1301c1f302$97669090$dc21970a@norris> Message-ID: <15571.47288.511762.515562@antilipe.corelatus.se> > Does anyone have some prebuilt routines for manipulating now() tuples, or > for converting them into C style seconds-since-blah values? > Alternatively can someone tell me the max size of the MicroS/S/MegaS > integers, so I can tell when it should overflow from one to the other (and > then I'll build some routines)? Looking at emulator/beam/bif.c, all three are 'small' integers, which should mean that they're 28 bits wide. Looking at emulator/beam/erl_time_sup.c, in the get_now() function, the second counter cannot be more than 999999. The microsecond counter depends on gettimeofday(2) behaviour. The linux manpage for this implies that the microsecond count will never exceed 999999. Keep in mind that now() does 'interesting' things if you rapidly change the system time. If you really want to know what the system thinks the time is, then time/0 may be a better choice. Matthias From erlounge@REDACTED Sun May 5 19:55:51 2002 From: erlounge@REDACTED (Erlounge) Date: Sun, 05 May 2002 18:55:51 +0100 Subject: Erlounge Stockholm In-Reply-To: <000101c1f29f$4c7a7460$1701a8c0@Domain> Message-ID: <200205051655.g45Gtpl01996@lejon.levonline.com> Hi, We are now proud to announce the venue for Erlounge Stockholm. At least 15 thirsty Erlang hackers will meet Wednesday May 8th at MacKinlays Inn, Flemminggatan 85 (at the crossing S:t Eriksg and Flemmingg.). There are still roam for more, just drop us an email if you are interested. At 19:00 Lars from T?rn? bryggeri will give us some additional guidance in the art of beer drinking. Synapse and Vindaloo host this event. The rest of the night you pay on your own. Some of us will meet at MacKinlays at 18.00 to get into the right mode. Cheers and welcome ! Per Bergqvist Patrik Winroth P.S. Note that this is a drinking event, accordingly we have not booked any food for the night. Prepare yourself so you will stand the night. D.S. (Sent from Bohemian Bagel Internet Cafe, Prague where I am preparing myself with a couple of Staropramen.). From Bruce@REDACTED Mon May 6 06:16:04 2002 From: Bruce@REDACTED (Bruce Fitzsimons) Date: Mon, 6 May 2002 16:16:04 +1200 Subject: now() and arithmetic References: <0d1301c1f302$97669090$dc21970a@norris> <15571.47288.511762.515562@antilipe.corelatus.se> Message-ID: <181301c1f4b4$bd0c8710$dc21970a@norris> H Matthias, > Looking at emulator/beam/bif.c, all three are 'small' integers, which > should mean that they're 28 bits wide. I couldn't see that but I wasn't sure where to look. Thanks a lot for your effort. > Looking at emulator/beam/erl_time_sup.c, in the get_now() function, > the second counter cannot be more than 999999. The microsecond counter > depends on gettimeofday(2) behaviour. The linux manpage for this implies > that the microsecond count will never exceed 999999. With 20/20 hindsight I can see thats logical - MicroS =1/Million and MegaS = 1 Million. Duh. > Keep in mind that now() does 'interesting' things if you rapidly > change the system time. If you really want to know what the system > thinks the time is, then time/0 may be a better choice. Its more for TimeToLive calculations, and the complications of converting time+date from/to a serial time value annoy me enough to (possibly foolishly) disregard the possibility. Does TZ actually affect now() on some platforms? Is this the "rapidly changing system time" or have you had some crazy users playing with the time? Many thanks, Bruce PS Here are my amazingly simple routines. now_to_timeval() -> now_to_timeval(now()). now_to_timeval({MegaSecs, Secs, MicroSecs}) -> {MegaSecs*1000000+Secs, MicroSecs}. timeval_to_now({Secs, MicroSecs}) -> {trunc(Secs / 1000000), Secs rem 1000000, MicroSecs}. From goran.bage@REDACTED Mon May 6 08:36:15 2002 From: goran.bage@REDACTED (Goran Bage) Date: Mon, 06 May 2002 08:36:15 +0200 Subject: Password check Message-ID: <3CD6245F.78DDEEFF@mobilearts.se> Hi, We have an application where we need to check that passwords are reasonably 'hard', i.e. not simple words or variants thereof. We would prefer to do it in Erlang and not redirect the check to the underlying OS. So if anyone knows where we get get our hands on such a beast I'd be grateful if you let me know about it. -- Goran ------------------------- May the Snow be with you ---- Goran Bage, MobilArts, www.mobilearts.se Tegnerlunden 3, SE-111 61 Stockholm, Sweden email:goran.bage@REDACTED, phone: +46 733 358405 From raimo@REDACTED Mon May 6 09:15:42 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Mon, 06 May 2002 09:15:42 +0200 Subject: Debugging inter-node spawning... References: , <200205020603.g4263c009800@vargen.levonline.com> Message-ID: <3CD62D9E.19684D63@erix.ericsson.se> A small objection: list_to_pid("<0.0.0>") is a bit hackish, is it not? Why not use whereis(user) instead? Like in: RP = rpc:call(per@REDACTED, erlang, whereis, [user]), io:format(RP,"Hello World !\n",[]). Since the process with the registered name 'user' is the one handling user I/O. / Raimo Niskanen, Erlang/OTP, Ericsson AB Per Bergqvist wrote: > > Hi Harley, > > No, io:format is not printf. > If you check io:format/3 it takes an i/o device pid as the first > argument. If the argument is omitted io:format will use the group > leader. > > To do output on the remote node do either: > a) > RP = rpc:call(per@REDACTED,erlang,list_to_pid,["<0.0.0>"]), > io:format(RP,"Hello World !\n",[]). > b) > LP = erlang:group_leader(), > RP = rpc:call(per@REDACTED,erlang,list_to_pid,["<0.0.0>"]), > erlang:group_leader(RP,self()), > io:format("Hello World !\n"), > erlang:group_leader(LP,self()). > > To do low level output use erlang:display. > > /Per > > > > > On Wed, 1 May 2002, Harley Gorrell wrote: > > > Spawning on the node works just fine. What should I look > > > at to figure out what is wrong? > > > > I received two replies, to this note which also went to > > this list. Thanks Andreas and Lennart! > > > > After reading them, I checked again that the cookie was > > correct (is was) and tried out the 'net_adm:ping' function > > which I hadnt known about. With ping I could then see a > > non-null list from nodes(). So I knew erlang was setup ok. > > > > After a bit more tinkering, I found that the call was > > indeed making the round trip, but the output of 'io:format' > > was appearing on the console of the spawning node. I was > > thinking that the output would appear on the remote node. > > > > Here is an example. 'echo:hi/1' is loaded on 'foo2@REDACTED' > > with 'c(echo)'. From a new erl, I spawn the function and > > the output appears locally. > > > > -------------------- > > > > $erl -sname foo1 > > Erlang (BEAM) emulator version 5.1 [source] > > > > Eshell V5.1 (abort with ^G) > > (foo1@REDACTED)1> spawn(foo2@REDACTED,echo,hi,[foo2]). > > hi2 'foo2' > > <38.48.0> > > (foo1@REDACTED)2> > > > > -------------------- > > > > Moral: 'io:format' is not 'printf'. > > > > thanks everyone, > > harley. > > > ========================================================= > Per Bergqvist > Synapse Systems AB > Phone: +46 709 686 685 > Email: per@REDACTED From etxuwig@REDACTED Mon May 6 10:27:48 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 6 May 2002 10:27:48 +0200 (MET DST) Subject: now() and arithmetic In-Reply-To: <181301c1f4b4$bd0c8710$dc21970a@norris> Message-ID: On Mon, 6 May 2002, Bruce Fitzsimons wrote: >> Keep in mind that now() does 'interesting' things if you rapidly >> change the system time. If you really want to know what the system >> thinks the time is, then time/0 may be a better choice. > >Its more for TimeToLive calculations, and the complications of >converting time+date from/to a serial time value annoy me enough >to (possibly foolishly) disregard the possibility. Does TZ >actually affect now() on some platforms? Is this the "rapidly >changing system time" or have you had some crazy users playing >with the time? No, it's manually changing the system time (or semi-automatically via e.g. rdate) that causes problems for erlang:now(). Matthias was probably referring to this thread, and related problems: http://www.erlang.org/ml-archive/erlang-questions/200203/msg00033.html The following code calculates the difference between two erlang:now() values without using bignums. It is significantly(?) cheaper than e.g. the calculation used in timer:tc/3. diff({M,S,U}, {M,S1,U1}) -> ((S-S1) * 1000) + ((U-U1) div 1000); diff({M,S,U}, {M1,S1,U1}) -> ((M-M1)*1000000+(S-S1))*1000 + ((U-U1) div 1000). (Of course, the difference won't be significant unless the calculation is performed extremely often -- which is probably never true for timer:tc/3.) /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From matthias@REDACTED Mon May 6 10:58:25 2002 From: matthias@REDACTED (Matthias Lang) Date: Mon, 6 May 2002 10:58:25 +0200 Subject: now() and arithmetic In-Reply-To: <181301c1f4b4$bd0c8710$dc21970a@norris> References: <0d1301c1f302$97669090$dc21970a@norris> <15571.47288.511762.515562@antilipe.corelatus.se> <181301c1f4b4$bd0c8710$dc21970a@norris> Message-ID: <15574.17841.209496.795655@antilipe.corelatus.se> > Does TZ actually affect now() on some platforms? I think the manpage is wrong: now() Returns the tuple {MegaSecs, Secs, Microsecs} which is the elapsed time since 00:00 GMT, January 1, 1970 (zero hour) on the assumption that the underlying OS supports this. Otherwise, some other point in time is chosen. It is also guaranteed that subsequent calls to this BIF returns continuously increasing values. Hence, the return value from now() can be used to generate unique time-stamps. It can only be used to check the local time of day if the time-zone info of the underlying operating system is properly configured. now() is defined as being the elapsed time since 00:00 GMT, Jan 1, 1970, so it should be independent of the timezone in any case. Maybe the last sentence should be moved to the calendar module, under now_to_local_time/1. Digging deeper: the value now() returns is based on sys_gettimeofday(), which, for all unix implementations, is a call to gettimeofday with a NULL second argument. Under linux that means TZ does not affect it. I'd be surprised if that wasn't so for other unices. No idea what VxWorks and Windows do. As far as I can see (quick look only!), the highres timer stuff in solaris is only used to fine-tune the value from gettimeofday. > Is this the "rapidly changing system time" or have you had some > crazy users playing with the time? Whenever one of Corelatus' magic boxes was newly installed and configured in the customer's test lab, the internal hardware watchdog would reboot it once. Embarassing when you're selling a 'carrier class' system. Turned out that all the systems had been sitting in storage for a month and had thus forgotten what the time was (we use a high MTBF 'supercap' instead of a battery, so the realtime clock can keep going for a week without power, but not a month). So, on first boot, they'd get a hardcoded time and, as soon as NTP was configured, the system time would adjust itself by about a year. Because of a bug in Erlang R7B-3 (fixed in R8B-1), Erlang's timers would go insane and trigger events nonstop. The VM's CPU use would be sky high, which the watchdog correctly diagnosed as a sign of insanity and rebooted. Now that the problem is fixed, the same series of events causes no greater damage than now() running 1% faster than it really should, so all of our internal timers are 1% shorter than nominal. Truly timing-critical events are managed by hardware, so this is OK for us. > PS Here are my amazingly simple routines. > > now_to_timeval() -> > now_to_timeval(now()). > > now_to_timeval({MegaSecs, Secs, MicroSecs}) -> > {MegaSecs*1000000+Secs, MicroSecs}. > > timeval_to_now({Secs, MicroSecs}) -> > {trunc(Secs / 1000000), Secs rem 1000000, MicroSecs}. If you use {Secs div 1000000, ... } it'll make systems without floating point happier. Matthias From eleberg@REDACTED Mon May 6 12:40:22 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Mon, 6 May 2002 12:40:22 +0200 (MET DST) Subject: now() and arithmetic Message-ID: <200205061040.g46AeMU21857@cbe.ericsson.se> > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Date: Mon, 6 May 2002 10:58:25 +0200 > From: Matthias Lang ...deleted > Digging deeper: the value now() returns is based on > sys_gettimeofday(), which, for all unix implementations, is a call to > gettimeofday with a NULL second argument. Under linux that means TZ > does not affect it. I'd be surprised if that wasn't so for other > unices. No idea what VxWorks and Windows do. As far as I can see According to the unix manual (www.opengroup.org), gettimeofday()s second argument should always be a null pointer. bengt From L.A.Timochouk@REDACTED Mon May 6 12:48:38 2002 From: L.A.Timochouk@REDACTED (Leonid Timochouk) Date: Mon, 6 May 2002 11:48:38 +0100 (BST) Subject: Password check In-Reply-To: <3CD6245F.78DDEEFF@mobilearts.se> Message-ID: Hello Goran & all Erlang users, There is a "cracklib" Open Source C library available for UNIX (and possibly other) systems which includes the functions you need (e.g. pro-active "FascistCheck" of passwords). You can either interface this library to Erlang, or re-write some subset of it in Erlang. It's not a readily available Erlang-only solution, but you may find it useful anyway. Yours sincerely, Dr Leonid Timochouk Computing Laboratory University of Kent at Canterbury England From per@REDACTED Mon May 6 14:00:03 2002 From: per@REDACTED (Per Hedeland) Date: Mon, 6 May 2002 14:00:03 +0200 (CEST) Subject: now() and arithmetic In-Reply-To: <181301c1f4b4$bd0c8710$dc21970a@norris> Message-ID: <200205061200.g46C03L06537@tordmule.bluetail.com> "Bruce Fitzsimons" wrote: > >PS Here are my amazingly simple routines. > >now_to_timeval() -> > now_to_timeval(now()). > >now_to_timeval({MegaSecs, Secs, MicroSecs}) -> > {MegaSecs*1000000+Secs, MicroSecs}. > >timeval_to_now({Secs, MicroSecs}) -> > {trunc(Secs / 1000000), Secs rem 1000000, MicroSecs}. Hm, any particular reason you want timevals? If you want to calculate differences, they're only marginally less awkward than now() values. Since you have bignums, you could just convert into microseconds instead - and bignums will be used for your timeval-seconds in any case. If bignums had existed in Erlang when now() was implemented, it would probably just have returned a single integer instead (and then Ulf would have requested the current implementation for efficiency reasons:-). --Per Hedeland per@REDACTED From per@REDACTED Mon May 6 14:23:04 2002 From: per@REDACTED (Per Hedeland) Date: Mon, 6 May 2002 14:23:04 +0200 (CEST) Subject: now() and arithmetic In-Reply-To: <15574.17841.209496.795655@antilipe.corelatus.se> Message-ID: <200205061223.g46CN4R06572@tordmule.bluetail.com> Matthias Lang wrote: > > > Does TZ actually affect now() on some platforms? > >I think the manpage is wrong: [snip] > It can only be used to check the local time of day > if the time-zone info of the underlying operating > system is properly configured. > >now() is defined as being the elapsed time since 00:00 GMT, Jan 1, >1970, so it should be independent of the timezone in any case. Maybe >the last sentence should be moved to the calendar module, under >now_to_local_time/1. It does sound weird - perhaps what it was supposed to say was that if your local time is set right, but your time zone is not (a rather common problem, actually), now() will *not* return time since the epoch even if your OS claims to support this (neither will gettimeofday(), of course). So I guess depending on your viewpoint, the answer to Bruce's question above could actually be "yes".:-) >Digging deeper: the value now() returns is based on >sys_gettimeofday(), which, for all unix implementations, is a call to >gettimeofday with a NULL second argument. Under linux that means TZ >does not affect it. As Bengt indicates, the second argument is irrelevant/obsolete/ deprecated and just generally useless. It's a remnant from a time when someone could actually think that there was an easy way out of the timezone/DST mess. > as soon as NTP was configured, the system >time would adjust itself by about a year. >Now that the problem is fixed, the same series of events causes no >greater damage than now() running 1% faster than it really should, so >all of our internal timers are 1% shorter than nominal. ...And after running for a mere 100 years, the "time" returned by now() will have caught up with reality.:-) --Per Hedeland per@REDACTED From eleberg@REDACTED Tue May 7 11:46:20 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Tue, 7 May 2002 11:46:20 +0200 (MET DST) Subject: Password check Message-ID: <200205070946.g479kKU02219@cbe.ericsson.se> > Date: Mon, 6 May 2002 11:48:38 +0100 (BST) > From: Leonid Timochouk > There is a "cracklib" Open Source C library available for UNIX (and available at http://www.users.dircon.co.uk/~crypto bengt From gerd@REDACTED Tue May 7 12:59:54 2002 From: gerd@REDACTED (Gerd Flaig) Date: Tue, 07 May 2002 12:59:54 +0200 Subject: emacs 21, comint and erlang-mode In-Reply-To: <20020330182417.I1134-100000@olgeni.olgeni> (Jimmy Olgeni's message of "Sat, 30 Mar 2002 22:29:20 +0100 (CET)") References: <20020330182417.I1134-100000@olgeni.olgeni> Message-ID: Jimmy Olgeni writes: > Looks like something changed in the comint package for emacs 21.x: erlang > mode hangs when waiting for the erl prompt, then times out after 60 > seconds. > > If you press Ctrl-G while it is hung, the prompt appears regularly. > > For some reason the loop in inferior-erlang-wait-prompt fails when > "looking-at" the comint-prompt-regexp. > > Silly workaround for your .emacs: > > (add-hook 'erlang-mode-hook (lambda () (setq comint-prompt-regexp ""))) > > :-) this didn't work for me. However, I found out that the behaviour of beginning-of-line has changed in Emacs 21. The included patch fixes the problem. Goodbyte, Gerd. P.S.: Maybe I'm just blind, but is there any home location / maintainer for erlang mode or even something newer than v2.4 you know of? --- erlang.el~ Tue May 7 12:30:44 2002 +++ erlang.el Tue May 7 12:42:26 2002 @@ -5242,7 +5242,7 @@ (let ((msg nil)) (while (save-excursion (goto-char (process-mark inferior-erlang-process)) - (beginning-of-line) + (forward-line 0) (not (looking-at comint-prompt-regexp))) (if msg () -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Erbprinzenstr. 4-12 D-76133 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From mickael.remond@REDACTED Tue May 7 22:30:41 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: 07 May 2002 22:30:41 +0200 Subject: Erwolf: An Erlang based Linux distribution Message-ID: <1020803442.1662.19.camel@louxor> Hello, I am currently building a new linux distribution based on Erlang, called Erwolf. The name is a contraction of Erlang and Wolf, because the ultimate goal of this distribution is to ease the construction of Erlang cluster, based on standard computer available on a network (like a horde of wolves). The cluster can be setup up without the need to install anything on the host computer. Erwolf Linux distribution characteristics are the following: 1. CDROM based: This distribution is provided as a bootable CDROM that contains everything you need to work with Erlang tools. The choice of the bootable support CDROM make it handy to have a complete Erlang system with you everywhere you go, without the need to install anything on the computer. 2. Erlang based: What I have in mind here is to provide a fullly configured Erlang development environment that include many third parties's contributions: Distel (Emacs levering Erlang), xmerl, and so on. The second step is to provide as many services as possible as Erlang service: Web: Inets, Yaws, Mail: epop Web application: BTT, Wiki, Webtool, ... LDAP ... The third step is to add scripts to make the distribution cluster oriented: I am planning to make it easy to quickly built a cluster of Erlang nodes on a given set of networked computers. For the moment I am only in the first step: I have a minimal development Erlang system with few extra modules (xmerl, distel, top, documentation and man pages) If you want to have a look at it, you can get the ISO image at: http://www.erlang-fr.org/erwolf-0.4.iso.bz2 This distribution is console only. I am planning to use HTTP modules and Emacs/Distel as the two possible user interfaces, depending on the task. to accomplish. Be careful. This is the very first public release. This means that it works on my computer but might not work at all on yours. Just a quick tip: The boot menu provide several choices: Select the position of your CDROM drive in your IDE chain. Most of the time, secondary master is the right choice on desktop computers and primary slave on laptop. (I realize that I should make the boot on secondary master the option and that I should provide a boot disk for non bootable cdrom drives, but anyway, this first release will let you get an idea of what I have in mind) You might need to wait one day or two to be able to download the iso image, because I changed the Erlang-fr hosting service to have more storage space (and thus be able to share a CDROM image). The DNS propagation might not be up to date everywhere. This distribution is built on top of the Linux From Scratch distribution. Your comments and suggestions are welcome. In particular, what Erlang addition would you need first and what services do you think it would be usefull to develop. I think that among the nearest planned feature, I will add escript, ermacs and a preconfigured Webtool interface. Cheers, -- Mickael Remond http://www.erlang-fr.org/ From phillipd@REDACTED Tue May 7 23:05:52 2002 From: phillipd@REDACTED (phillipd@REDACTED) Date: Tue, 7 May 2002 14:05:52 -0700 Subject: Erwolf: An Erlang based Linux distribution Message-ID: > -----Original Message----- > From: Mickael Remond [mailto:mickael.remond@REDACTED] > Sent: Tuesday, May 07, 2002 1:31 PM > To: erlang-questions@REDACTED > Subject: Erwolf: An Erlang based Linux distribution > > > Hello, > > I am currently building a new linux distribution based on > Erlang, called > Erwolf. The name is a contraction of Erlang and Wolf, because the > ultimate goal of this distribution is to ease the > construction of Erlang > cluster, based on standard computer available on a network > (like a horde > of wolves). The cluster can be setup up without the need to install > anything on the host computer. > > Erwolf Linux distribution characteristics are the following: > ---- snip ----- This sounds like and interesting project. What is your "Target Market?" Or is this mostly for fun. Keep the info coming.... Dale From Simon.Chappell@REDACTED Tue May 7 23:56:32 2002 From: Simon.Chappell@REDACTED (Chappell, Simon P) Date: Tue, 7 May 2002 16:56:32 -0500 Subject: Erwolf: An Erlang based Linux distribution Message-ID: <1AA6971F96FADB4A96CF73E4729B05F102B2C7@USEVS012.leinternal.com> This sounds very interesting, please keep us/me in the loop. We are just getting official recognition for Linux here. We have transitioned from "unofficial unapproved" to "unofficial recognised"! Progress is a wonderful thing. :-) I am interested in adding Erlang to my mix of programming languages because it looks like it better solves some of the problems that I currently use Java to address. I have been lurking on the list for a while, as I clear space on my schedule to do a little self-directed learning. Simon ----------------------------------------------------------------- Simon P. Chappell simon.chappell@REDACTED Java Programming Specialist www.landsend.com Lands' End, Inc. (608) 935-4526 >-----Original Message----- >From: Mickael Remond [mailto:mickael.remond@REDACTED] >Sent: Tuesday, May 07, 2002 3:31 PM >To: erlang-questions@REDACTED >Subject: Erwolf: An Erlang based Linux distribution > > >Hello, > >I am currently building a new linux distribution based on >Erlang, called >Erwolf. The name is a contraction of Erlang and Wolf, because the >ultimate goal of this distribution is to ease the construction >of Erlang >cluster, based on standard computer available on a network >(like a horde >of wolves). The cluster can be setup up without the need to install >anything on the host computer. > >Erwolf Linux distribution characteristics are the following: > > 1. CDROM based: >This distribution is provided as a bootable CDROM that contains >everything you need to work with Erlang tools. >The choice of the bootable support CDROM make it handy to have a >complete Erlang system with you everywhere you go, without the need to >install anything on the computer. > > 2. Erlang based: >What I have in mind here is to provide a fullly configured Erlang >development environment that include many third parties's >contributions: >Distel (Emacs levering Erlang), xmerl, and so on. > >The second step is to provide as many services as possible as Erlang >service: Web: Inets, Yaws, > Mail: epop > Web application: BTT, Wiki, Webtool, ... > LDAP > ... > >The third step is to add scripts to make the distribution cluster >oriented: >I am planning to make it easy to quickly built a cluster of >Erlang nodes >on a given set of networked computers. > >For the moment I am only in the first step: I have a minimal >development >Erlang system with few extra modules (xmerl, distel, top, documentation >and man pages) >If you want to have a look at it, you can get the ISO image at: >http://www.erlang-fr.org/erwolf-0.4.iso.bz2 > >This distribution is console only. I am planning to use HTTP >modules and >Emacs/Distel as the two possible user interfaces, depending on >the task. >to accomplish. > >Be careful. This is the very first public release. This means that it >works on my computer but might not work at all on yours. Just a quick >tip: The boot menu provide several choices: Select the position of your >CDROM drive in your IDE chain. Most of the time, secondary >master is the >right choice on desktop computers and primary slave on laptop. (I >realize that I should make the boot on secondary master the option and >that I should provide a boot disk for non bootable cdrom drives, but >anyway, this first release will let you get an idea of what I have in >mind) > >You might need to wait one day or two to be able to download the iso >image, because I changed the Erlang-fr hosting service to have more >storage space (and thus be able to share a CDROM image). The DNS >propagation might not be up to date everywhere. > >This distribution is built on top of the Linux From Scratch >distribution. > >Your comments and suggestions are welcome. In particular, what Erlang >addition would you need first and what services do you think >it would be >usefull to develop. > >I think that among the nearest planned feature, I will add escript, >ermacs and a preconfigured Webtool interface. > >Cheers, > >-- >Mickael Remond >http://www.erlang-fr.org/ > > From momoh_a@REDACTED Wed May 8 06:23:43 2002 From: momoh_a@REDACTED (Momoh Abdul) Date: Wed, 08 May 2002 06:23:43 +0200 Subject: Kindly get Back To Me Please. Message-ID: <200205080417.g484H6j40479@hades.cslab.ericsson.net> ATT: CONFIDENTIAL PROPOSAL You may be surprised to receive this letter from me, since you do not know me personally. I am ABDUL MOMOH, the son of NDIATA MOMOH, the most popular black farmer in Zimbabwe. He was recently murdered in the land dispute in my country. I got your contact through network online hence decided to write you. Before the death of my father, he had taken me to Johannesburg to deposit the sum of US8.5 million (Eight million, Five Hundred United States dollars), in one of the private security company, as he foresaw the looming danger in Zimbabwe. This money was deposited in a box as gemstones to avoid much demurrage from Security Company. This amount was meant for the purchase of new machines and chemicals for the farms and establishment of new farms in Swaziland. This land problem came when Zimbabwean President Mr. Robert Mugabe introduced a new land Act Reform wholly affecting the rich white farmers and some few black farmers, and this resulted to the killing and mob action by Zimbabwean war veterans and some lunatics in the society. In fact a lot of people were killed because of this Land reform Act for which my father was one of the victims. It is against this background that, my family and I fled Zimbabwe for fear of our lives and are currently staying in the Netherlands where we are seeking political asylum and more so, have decided to transfer my father's money to a more reliable foreign account. Since the law of Netherlands prohibits a refugee (asylum seeker) to have such amount of money in any bank account or to be involved in any financial transaction of such magnitude throughout the territorial zone of Netherlands. As the first son, I am saddled with the responsibility of seeking a genuine foreign account where this money could be transferred without the knowledge of my government who are bent on taking everything we have got. The South African government seems to be playing along with them. I am faced with the dilemma of moving this amount of money out of South Africa for fear of going through the same experience in future, both countries have similar political history. As a businessman, I am seeking for a partner, who I have to entrust my future and that of my family in his hands. I must let you know that this transaction is risk free. If you accept to assist my family, and me all I want you to do for me, is to make an arrangement with the security company to clear the consignment (funds) from their affiliate office here in the Netherlands. I have already given directives for the consignment to be brought from South Africa to The Netherlands. But before then all modalities will have to be put in place like change of ownership of the consignment and more importantly this money I intend to use for investment. I have two options for you. Firstly I can give you certain percentage of the money for for agreeing to assist in this transaction. Or you can go into partnership with me for the proper profitable investment in your country. Whichever option you want, feel free to notify me. I have also mapped out 5% of this money for all kinds of expenses incurred in the process of this transaction. Contact me with this E-mail while I implore you to maintain the absolute secrecy required in this transaction. Thanks, GOD BLESS YOU Yours Faithfully, Abdul Momoh. From mickael.remond@REDACTED Wed May 8 08:24:44 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: 08 May 2002 08:24:44 +0200 Subject: Erwolf: An Erlang based Linux distribution In-Reply-To: References: Message-ID: <1020839085.28439.5.camel@louxor> Le mar 07/05/2002 ? 23:05, phillipd@REDACTED a ?crit : >> This sounds like and interesting project. > What is your "Target Market?" > Or is this mostly for fun. I do that mostly for fun and because I think I will need it. Moreover, this distribution is a good material for teaching Erlang: I come with several bootable CD, one for each "student", and then they can boot the distribution and start playing with Erlang without having to spend time on configuration, installation. They can even test important Erlang contributions that were put and configured on the CDROM. > Keep the info coming.... of course :-) Cheers, -- Micka?l R?mond From etxuwig@REDACTED Wed May 8 10:36:37 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 8 May 2002 10:36:37 +0200 (MET DST) Subject: backmailing Mickael (Re: Returned mail:) In-Reply-To: <200205080832.g488W8s7025422@penguin.wise.edt.ericsson.se> Message-ID: Mickael, Is there something wrong with your email setup, or is this caused by some dirt at our end? /Uffe On Wed, 8 May 2002, Mail Delivery Subsystem wrote: > ----- The following addresses had permanent fatal errors >----- > (reason: 550 relaying to >prohibited by administrator) > > ----- Transcript of session follows ----- >... while talking to mx1.tuxfamily.net.: >>>> DATA ><<< 550 relaying to prohibited by >administrator 550 5.1.1 ... User >unknown <<< 503 Valid RCPT TO must precede DATA -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From per@REDACTED Wed May 8 15:30:23 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 08 May 2002 14:30:23 +0100 Subject: =?iso-8859-1?q?erl=5Finterface?= Message-ID: <200205081230.g48CUNH31751@raven.levonline.com> Hi, Attached is a fix to a bug in erl_interface that causes messages without payload to generate decode failures. Who is maintaining erl_interface nowadays ? /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R8B-1.patch11 Type: application/octet-stream Size: 683 bytes Desc: not available URL: From per@REDACTED Wed May 8 15:26:57 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 08 May 2002 14:26:57 +0100 Subject: distributed applications (PLEASE COMMENT) Message-ID: <200205081226.g48CQwH30041@raven.levonline.com> Hi, After looking deeper into the terrible deadlocks in dist_ac I decided to do something about it. Attached is a large patch. Can you please look on the new implementation/behaviour and comment. The differences are: 1) Deadlocks caused by message exchange in dist_ac removed. 2) User and server code use different locks to avoid deadlocks caused by locking. 3) Protocol version stepped to 2 which is incompatible with version 1. If a version 2 node detects a version 1 node it will commit suicide. I.e. all nodes in a providing distributed applications must run the same protocol version. (Version 1 is useless anyway). 4) Applications will stay on the running node until a node with higher priority is available. 5) New API application:whereis_application(AppName) to find the current node for an application. Please comment on this. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R8B-1.patch9 Type: application/octet-stream Size: 29108 bytes Desc: not available URL: From abdulkadiri@REDACTED Thu May 9 04:52:32 2002 From: abdulkadiri@REDACTED (Abdul Kadiri) Date: Thu, 09 May 2002 04:52:32 +0200 Subject: Confidential Proposal Message-ID: <200205090245.g492jhj45711@hades.cslab.ericsson.net> 31-620722849 31-619138901( fax ) ATT: REQUEST FOR URGENT BUSINESS RELATIONSHIP This letter is important, and requires your immediate attention! Firstly, I must solicit your strictest confidence in this transaction. I am a top official of the Federal Government Contract Review Panel, I am currently on official assignment here in The Netherlands. My local partners and I are interested in importation of goods into our country with funds which are presently trapped in an interest bearing Federal Government suspense account for which we need a foreign account that you have absolute control over in your country or a third country other than Nigeria to receive the funds. It was when the new civilian administration in Nigeria set up this panel to review all contracts/ oil licenses to determine their authenticity, propriety in the light of the economic and political realities of my country that we identified a lot of inflated contract funds which are currently floating in our Apex Bank. At this moment we have worked out modalities within ourselves to transfer the sum of US$ 8,500,000,00 (eight Million Five Hundred Thousand United States Dollars) only, for our personal use. However, by virtue of our positions as civil servant and members of the Contract Review Panel, we cannot acquire this money in our names. Consequently, I was delegated by my colleagues as a matter of trust to look for an overseas partner into whose account we can transfer this said money, hence this letter to you. Furthermore, my colleagues are willing to transfer the total sum of US$8,500,000,00 into your account for disbursement. Your areas of specialization is not a hindrance to the successful execution of this transaction and the account required for this project can either be PERSONAL, COMPANY or an OFFSHORE account, you have total control over. Needless to say, the trust reposed on you at this juncture is enormous. In return, we have agreed to offer you 20% of this sum while 5% shall be set aside for incidental expenses between the parties in the course of this transaction. You must however, note that this transaction is subject to the following terms and conditions: (1) Our conviction of your transparent honesty and diligence, (2) That you would treat this transaction with utmost assistance and confidentiality. (3) That the funds would only be transferred to an account you have absolute control over. (4) That the funds will be free from undue taxation Modalities have been worked out to the highest level for the immediate transfer of the funds within 14 working days subject to your swift response and satisfaction of the above stated terms. Our assurance to you is that your role is RISK FREE!. To accord this transaction the legality it deserves and for mutual security of the funds, the whole approval procedure will be officially and legally processed with your name or the name of any company you may nominate as the ultimate beneficiary. Once more, I want you to understand that having put in over 13 years in the civil service of my country, I am averse to having my image and carrier dented. Therefore this matter should be treated with utmost secrecy and urgency that is why I have given you my Amsterdam tel/fax number for contact. Kindly expedite action, to enable us include this transfer in the batch of payment to contractors which is usually carried out on quarterly basis as scheduled. Yours Sincerely, DR Abdul Kadiri From abdulkadiri@REDACTED Thu May 9 07:08:00 2002 From: abdulkadiri@REDACTED (Abdul Kadiri) Date: Thu, 09 May 2002 07:08:00 +0200 Subject: Confidential Proposal Message-ID: <200205090501.g4951Lj46130@hades.cslab.ericsson.net> Tel:+31 623 722 849 Fax:+31 619 138 901 ATT: REQUEST FOR URGENT BUSINESS RELATIONSHIP This letter is important, and requires your immediate attention! Firstly, I must solicit your strictest confidence in this transaction. I am a top official of the Federal Government Contract Review Panel, I am currently on official assignment here in The Netherlands. My local partners and I are interested in importation of goods into our country with funds which are presently trapped in an interest bearing Federal Government suspense account for which we need a foreign account that you have absolute control over in your country or a third country other than Nigeria to receive the funds. It was when the new civilian administration in Nigeria set up this panel to review all contracts/ oil licenses to determine their authenticity, propriety in the light of the economic and political realities of my country that we identified a lot of inflated contract funds which are currently floating in our Apex Bank. At this moment we have worked out modalities within ourselves to transfer the sum of US$ 8,500,000,00 (Eight Million Five Hundred Thousand United States Dollars) only, for our personal use. However, by virtue of our positions as civil servant and members of the Contract Review Panel, we cannot acquire this money in our names. Consequently, I was delegated by my colleagues as a matter of trust to look for an overseas partner into whose account we can transfer this said money, hence this letter to you. Furthermore, my colleagues are willing to transfer the total sum of US$8,500,000,00 into your account for disbursement. Your areas of specialization is not a hindrance to the successful execution of this transaction and the account required for this project can either be PERSONAL, COMPANY or an OFFSHORE account, you have total control over. Needless to say, the trust reposed on you at this juncture is enormous. In return, we have agreed to offer you 20% of this sum while 5% shall be set aside for incidental expenses between the parties in the course of this transaction. You must however, note that this transaction is subject to the following terms and conditions: (1) Our conviction of your transparent honesty and diligence, (2) That you would treat this transaction with utmost assistance and confidentiality. (3) That the funds would only be transferred to an account you have absolute control over. (4) That the funds will be free from undue taxation Modalities have been worked out to the highest level for the immediate transfer of the funds within 14 working days subject to your swift response and satisfaction of the above stated terms. Our assurance to you is that your role is RISK FREE!. To accord this transaction the legality it deserves and for mutual security of the funds, the whole approval procedure will be officially and legally processed with your name or the name of any company you may nominate as the ultimate beneficiary. Once more, I want you to understand that having put in over 13 years in the civil service of my country, I am averse to having my image and carrier dented. Therefore this matter should be treated with utmost secrecy and urgency that is why I have given you my Amsterdam tel/fax number for contact. Kindly expedite action, to enable us include this transfer in the batch of payment to contractors which is usually carried out on quarterly basis as scheduled. Yours Sincerely, DR Abdul Kadiri From C.Reinke@REDACTED Thu May 9 16:47:34 2002 From: C.Reinke@REDACTED (C.Reinke) Date: Thu, 09 May 2002 15:47:34 +0100 Subject: ANN: Haskell Communities and Activities Report (2nd edition) Message-ID: Haskell??? on the Erlang list?? Yes. And why not? Many of us try to follow functional programming activities across the board. So, please, read on - I'll keep it short: The 2nd edition of the Haskell Communities and Activities Report is now available (PDF,Postscript,HTML) at: http://www.haskell.org/communities/ It is part of a 6-monthly survey, attempting to provide an overview of recent activities in the various areas Haskellers are active in. Enough said about that here, but I hope you'll find it an interesting read (the 1st edition is also still available). I would very much like to see a similar effort in the Erlang Community (or does it exist already?). It's not as exiting as meeting for a drink;) but it would make it easier to keep track of developments (some of which happen away from this list), without having to google all Erlang-related web sites every few months (e.g. what is the state of that Wings community, or Yaws, what happened to that peer-to-peer discussion, is the type system usable yet, or who is working on it, what about the model-checking, who is using Erlang now, what for, how are they affected by the current economy, who is offering Erlang training, or Erlang jobs, etc. etc. ?). The reports would work as a complement to existing web sites and mailing lists. Btw, there's no reason why people in Haskell-land shouldn't cooperate or exchange ideas with people in Erlang-land, and there have been some productive examples already (concurrency/distribution, type systems). There are the usual differences, e.g., about theory and practice of type and other safety;-) but I've got the impression that the exchanges have been fruitful for both sides, as the expertise of one group challenges the assumptions of the other. Activity reports could help to foster such cooperations, or just to spread and document some ideas. As the current editor of the Haskell version, I'd be willing to cross-reference. Cheers, Claus From fritchie@REDACTED Fri May 10 06:52:06 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Thu, 09 May 2002 23:52:06 -0500 Subject: Announcement: first release for Berkeley DB driver for R8 Message-ID: <200205100452.g4A4q6R00644@snookles.snookles.com> I'll be sending an announcement to the User Contributions editor shortly. For those of you who just can't wait for the editor to create a link at http://www.erlang.org/user.html, the source distribution can be found at http://www.snookles.com/erlang/. I'm happy to announce the first public release of an Erlang R8 driver for Berkeley DB 4.0. It works quite well, and there aren't any major bugs or memory leaks that I'm aware of. Well, that's not quite true. I don't know if the implementation of the cursor portion of the DB API is 100% solid when run on a VM with threads support and enabled (via "erl +A5" or whatever).... I'll include the README file below, rearranged slightly for the imaptient reader: -Scott --- snip --- Limitations =========== See the comments at the top of ../src/berkeley_db.erl for details on the limitations on this release. The most noteworthy limitation is that the transaction subsystem is not yet supported. I'd started this project thinking I knew how I'd do it ... but an assumption turned out to be incorrect. I'm releasing this now without supporting transactions so that I have a release "out there" while I work on getting the transaction subsystem to play nicely with Pthreads separate from the one running the Erlang VM. Usage ===== With few differences, this implementation exposes the Berkeley DB API as a C programmer sees it. Users should be familiar with DB's C API before attempting to use this driver. The API is documented in the "docs" subdirectory of the source distribution; it is also available at http://www.sleepycat.com/docs/index.html. The regression test functions provide the most concrete examples of how to write Erlang code to use the driver. License ======= I'm going to use the Berkeley BSD license. See the file "LICENSE" at the top of the source distribution directory. I am not an attorney. As far as I know, the BSD license I'm applying to the C protion of the driver does not conflict with the Berkeley DB code's license. If it turns out that my assumption is incorrect, I will reissue this distribution with two different licenses: one compatible with the Berkeley DB license for those files that require it, and the BSD license for everything else. Compilation instructions ======================== 0. You must have Erlang R8 installed on your system. I haven't tried this driver with R7; I don't know if it would work. This driver ought to work on any platform supported both by DB and Erlang. I have only tried it under FreeBSD 4.5, Linux RedHat 6.1, and Solaris 8 for Intel/x86. There shouldn't be any problem with FreeBSD 4.x, more recent Linux distributions, or older Solaris releases. I'd appreciate reports on other UNIX platforms.... This ought to work on Win32 platforms, too, but I haven't tried it. at the very least, the makefile `i have included will not work. Sorry. 1. You must have Berkeley DB version 4.0.14 installed on your system before proceeding any further. Earlier releases of 4.0.x may work, but you are on your own if you try it. Later releases should be fine, but since there aren't any newer releases yet, it's tough to test. :-) The source code can be downloaded at http://www.sleepycat.com/download.html. Follow the installation docs in the DB distribution. Shared library support is included by default, so you don't need to do anything special for it. If you want to try using the RPC server code, add "--enable-rpc" to the arguments you give to "configure". I have several different versions of DB installed on my development machine, so I added "--prefix=/usr/local/DB4.0" to "configure"'s arguments in order to avoid clobbering the other versions. Note that that directory also appears in ../src/Makefile. Linux users (and perhaps other platforms) may have to do some additional work in order to tell "ldconfig" (or whatever manages your shared libraries) where the DB 4.0 shared library is stored. In my case, that meant adding a "/usr/local/DB4.0/lib" line to /etc/ld.so.conf and then running "ldconfig". FreeBSD 4.5 didn't require any such special magic. For Solaris 8, you can use "crle" to add /usr/local/DB4.0 (or whatever you call it) to the library search path, or simply create a couple of symlinks in /usr/lib: "ln -s /usr/local/DB4.0/libdb-4.0.so /usr/lib" and "ln -s /usr/local/DB4.0/libdb-4.so /usr/lib" 2. Edit ../src/Makefile as appropriate. All the items that likely require changes are near the top. 3. Change directory to ../src if you haven't already. 4. Run "make" 5. Run the following command: erl -pz ../ebin -pz ../priv -run berkeley_db regression_test -run erlang halt You should see the following output: Erlang (BEAM) emulator version 5.1.1 [source] [threads:0] Eshell V5.1.1 (abort with ^G) 1> Turning off debugging to insert 25000 records Returning driver debugging to status 0 If you made it this far, the regression test passed. If Erlang exits with any kind of error (most likely a 'badmatch' error), then the not-very-complete regression test failed. 6. Copy ../ebin/*.beam and ../priv/*.so to whereever you wish to install them. There doesn't seem to be much tradition or custom where dynamic driver files ought to be installed. (TODO: Figure out what better to do here.) So, for now, copy those files where you think is appropriate, and always start "erl" with either "-pa" or "-pz" flags specifying the directory(ies) where you installed those files. 7. As a former colleague of mine would always say: "Have fun!" From team@REDACTED Fri May 10 16:49:35 2002 From: team@REDACTED (Your Control-IT Team) Date: Fri, 10 May 2002 16:49:35 +0200 Subject: Undefined referrences in ttsl_drv.c Message-ID: <000901c1f831$e71da450$0100a8c0@berndt.213.252.1.1> Hi I am a completely ERLANG novice so please excuse any "stupid" questions. I am running SuSE 8.0 (2.4.18-64GB-SMP) on a dual Athlon MP machine with a Tyan Thunder K7 board and 1 GB of high quality RAM (original Infineon). I have downloaded Erlang/OTP R8B-1 for Linux. I have installed all the neccessary programs according to the README file. "/configure"without and with options "enable_hipe" and "enable_threads" reported no problems or errors, but I can't compile successfully. "make" (being done as root) resulted in a lot of errors reading like: ...erts/emulator/drivers/unix/ttsl_drv.c "undefined reference to tgetent" dito undefined reference to tgetnum, tgetflag, tgetstr, etc. Additionally I get an "Error 1" in .../otp_src_R8B-1/bin/i686-pc-linux-gnu/beam.instr The path is existing and there are a couple of freshly generated executables but there is no such file or directory as "beam.instr". I am using gcc version 2.95.3 20010315 (SuSE). What did I do wrong? Any ideas? Thanks a lot to the ERLANG community! Have a nice weekend bernie From kent@REDACTED Fri May 10 17:52:03 2002 From: kent@REDACTED (Kent Boortz) Date: 10 May 2002 17:52:03 +0200 Subject: Undefined referrences in ttsl_drv.c In-Reply-To: <000901c1f831$e71da450$0100a8c0@berndt.213.252.1.1> References: <000901c1f831$e71da450$0100a8c0@berndt.213.252.1.1> Message-ID: "Your Control-IT Team" writes: > "make" (being done as root) resulted in a lot of errors reading like: > ...erts/emulator/drivers/unix/ttsl_drv.c "undefined reference to tgetent" > dito undefined reference to tgetnum, tgetflag, tgetstr, etc. There is a configure test that is less than perfect that looks for a library where those functions are located. If no library was found the configure script should terminate with an error report but it does not. AC_CHECK_LIB(termlib, tgetent) if test $ac_cv_lib_termlib_tgetent = no ; then AC_CHECK_LIB(curses, tgetent) if test $ac_cv_lib_curses_tgetent = no ; then AC_CHECK_LIB(ncurses, tgetent) if test $ac_cv_lib_ncurses_tgetent = no ; then AC_CHECK_LIB(termcap, tgetent) fi fi fi So my guess is that you need to install "libncurses.so" or similar, remove the "config.cache" file and run ./configure again. I don't know if this solves all your build problems but hopefully it solves some, kent From rpettit@REDACTED Fri May 10 21:17:47 2002 From: rpettit@REDACTED (Rick Pettit) Date: Fri, 10 May 2002 14:17:47 -0500 (CDT) Subject: =?iso-8859-1?q?erl=5Finterface?= In-Reply-To: <200205081230.g48CUNH31751@raven.levonline.com> Message-ID: > Attached is a fix to a bug in erl_interface that causes > messages without payload to generate decode failures. > > Who is maintaining erl_interface nowadays ? Just out of curiousity, what exactly do you mean when you way "messages w/out payload"? I have worked a little with Erlang at work and am considering wrapping the erl_interface in C++ in order for existing C++ applications to easily talk to Erlang nodes (we have previously done this w/request brokers that talk TCP on one side and Erlang messaging on the other). I am also curious as to who is maintaining the erl_interface, as well as how actively they are maintaining it and if it is considered "stable" by the Erlang masses. -Rick From team@REDACTED Fri May 10 22:47:39 2002 From: team@REDACTED (Your Control-IT Team) Date: Fri, 10 May 2002 22:47:39 +0200 Subject: Undefined referrences in ttsl_drv.c Message-ID: <010801c1f863$ec7277a0$0100a8c0@berndt.213.252.1.1> Hi Kent Boortz >So my guess is that you need to install "libncurses.so" or similar, Thanks a lot for your recommendation! It worked marvelously :-)) I installed something called "ncurses-devel" in SuSE 8.0 (described as "includes the development tools, headers and static libraries for the New curses (ncurses)"), erased the OTP R8B-1 subdirectories (just in case), and ran "./configure" again (without stating any options). Then I ran "make". It worked like a charme :-)) I tested the result with "bin/erl" and here was the Eshell V5.1.1 "make install" then ran without problems as well. Have a nice weekend + cu on the bit stream Thanks to Costel Vrinceanu for his tips as well! Bernie -----Original Message----- From: Kent Boortz To: Your Control-IT Team Cc: erlang-questions@REDACTED Date: Freitag, 10. Mai 2002 18:30 Subject: Re: Undefined referrences in ttsl_drv.c > >"Your Control-IT Team" writes: >> "make" (being done as root) resulted in a lot of errors reading like: >> ...erts/emulator/drivers/unix/ttsl_drv.c "undefined reference to tgetent" >> dito undefined reference to tgetnum, tgetflag, tgetstr, etc. > >There is a configure test that is less than perfect that looks for a >library where those functions are located. If no library was found the >configure script should terminate with an error report but it does >not. > > AC_CHECK_LIB(termlib, tgetent) > if test $ac_cv_lib_termlib_tgetent = no ; then > AC_CHECK_LIB(curses, tgetent) > if test $ac_cv_lib_curses_tgetent = no ; then > AC_CHECK_LIB(ncurses, tgetent) > if test $ac_cv_lib_ncurses_tgetent = no ; then > AC_CHECK_LIB(termcap, tgetent) > fi > fi > fi > >So my guess is that you need to install "libncurses.so" or similar, >remove the "config.cache" file and run ./configure again. I don't know >if this solves all your build problems but hopefully it solves some, > >kent > From kent@REDACTED Sat May 11 00:34:32 2002 From: kent@REDACTED (Kent Boortz) Date: 11 May 2002 00:34:32 +0200 Subject: erl_interface In-Reply-To: References: Message-ID: Rick Pettit writes: > I am also curious as to who is maintaining the erl_interface, as well as > how actively they are maintaining it and if it is considered "stable" by > the Erlang masses. Strange question. The OTP team is maintaining it ;-) When other parts of the system is updated that have an effect on erl_interface then it is updated and new test cases are written. Erl_interface is used by our customers in real products so it should be considered "stable". If you find it not to be, please let us know in what way it needs improvements. Erl_interface is also used by the code generated by the IDL compiler. I'm not sure but I think some customers use IDL and C as well. I daily feel that we let you, OpenSource users, down not being active enough on the mailing list, not updating www.erlang.org often enough, not thanking for the valuable patches and bug reports enough, not adding your sent patches fast enough and not providing new intermediate releases often enough. We also sit on the documentation system and the test server that should have been released as OpenSource years ago. OTP has become a very complex product and we are very few to maintain, improve and add new functionality to it. We have to put priority to the paying customers and there is very little time left for other work. We also have a strong focus on stability and backward compatibility because of the type of products our customers create using Erlang/OTP. This sometimes makes it a slow process rewriting parts that in the best of worlds should be rewritten from scratch. This focus doesn't always fit well with an OpenSource product. Code sent so us don't always make it into the product. We could branch of the OpenSource version from the commercial version but our lack of time will make it hard to merge improvements and bug fixes done in the commercial version into the OpenSource version. We could do more but we do provide you with all the bug fixes, release notes, documentation, new code and try to answer questions on the mailing list. We also test the OpenSource build daily on FreeBSD and different Linux versions (our commercial build is slightly different, it is done direct within our CM system). We merge changes from the Hipe project and run daily tests with Hipe and unified heap. We are strongly determined to support the OpenSource version of Erlang/OTP the best way we can. And I hope that you will continue to help us improve Erlang/OTP, kent From mickael.remond@REDACTED Sat May 11 12:01:51 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 11 May 2002 11:01:51 +0100 Subject: backmailing Mickael (Re: Returned mail:) Message-ID: <2.1-199760-393-A-OEWW@mail.club-internet.fr> Ulf Wiger wrote: > Mickael, > > Is there something wrong with your email setup, or is this > caused by some dirt at our end? > Thank you for letting me know the problem. The mail was not properly forwarded after erlang-fr server migration. I fixed the setup and my mail should now work correctly. Please, do not hesitate to forward me the mail that did not reach me. From per@REDACTED Sat May 11 12:47:00 2002 From: per@REDACTED (Per Bergqvist) Date: Sat, 11 May 2002 11:47:00 +0100 Subject: =?iso-8859-1?q?erl=5Finterface?= In-Reply-To: Message-ID: <200205110947.g4B9l0u11621@raven.levonline.com> > > We are strongly determined to support the OpenSource version of > Erlang/OTP the best way we can. And I hope that you will continue > to help us improve Erlang/OTP, > I am very grateful for all of support you do give the community. You have a devoted growing community out here. We should try to figure out how you can benefit from us in the best way. /Per From vances@REDACTED Sat May 11 23:40:21 2002 From: vances@REDACTED (Vance Shipley) Date: Sat, 11 May 2002 17:40:21 -0400 Subject: erl_interface In-Reply-To: ; from kent@erix.ericsson.se on Sat, May 11, 2002 at 12:34:32AM +0200 References: Message-ID: <20020511174021.A344@mobility.motivity.ca> I can't help but interject at this point on the subject of message types in erl_interface. It was asked what a zero length message would be. The answer is that there are a number of message types and some of those messages don't have any payload. An example is UNLINK. I have previously reported that you can't determine message type with erl_interface in R8B. It's supposed to be in the ErlMessage structure but it never gets set. The good news is that if you use the new ei library it does work and I suppose that is all that is really necessary at this point. All new work we are doing is based on ei and it works well. -Vance -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Vance Shipley Sent: Tuesday, November 13, 2001 5:14 PM To: Erlang Questions Subject: ErlMessage emsg; emsg.type == 0 I'm having trouble with erl_interface on R8B. I'm porting some code written with the erl_interface library, not ei standalone. The examples in the tutorial don't work either. cnode_s.c: ErlMessage emsg; /* Incoming message */ ... got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); if (got == ERL_TICK) { /* ignore */ } else if (got == ERL_ERROR) { loop = 0; } else { if (emsg.type == ERL_REG_SEND) { ... <----- *** NOT REACHED *** } } In all cases (emsg.type == 0). If you ignore this there is in fact a valid message there, the rest of the structure has been filled in approriately, as far as I can tell. typedef struct { int type; ETERM *msg; ETERM *to; ETERM *from; char to_name[MAXREGLEN]; } ErlMessage; -Vance Vance Shipley Motivity Telecom Inc. +1 519 579 5816 From matthias@REDACTED Sun May 12 12:49:48 2002 From: matthias@REDACTED (matthias@REDACTED) Date: Sun, 12 May 2002 12:49:48 +0200 Subject: Erlounge report In-Reply-To: <3CDE176A.BBEC01C6@corelatus.se> Message-ID: <15582.18636.266555.165321@beladrome.corelatus.se> > How was erlang_beer? Pretty cool. I'd been out in the sun for a bit of the afternoon, so I was already feeling decently happy after the first Lundgren's Lager. At that point Lars the beer Expert from the local microbrewery shooed the 15 or 20 of us down into the beer tasting cellar and we were encouraged to critically judge different beers. The great thing about beer tasting, unlike wine tasting, is that you're not expected to spit it out again. After 10 minutes of trying, I've realised that producing an accurate list of who was there is futile. Bjarne D?cker (lab boss at the lab where it all started) was definitely there, about half of the original Bluetail was definitely not there and I now know what eleberg@REDACTED looks like. Anyhow, thanks to Per Bergqvist and Patrik Winroth for their organisational efforts and to synap.se and Vindaloo AB for picking up the beer tab. Matthias From ds.erl@REDACTED Sun May 12 19:08:25 2002 From: ds.erl@REDACTED (Daniel Solaz) Date: Sun, 12 May 2002 19:08:25 +0200 Subject: memsup:get_system_memory_data/0 not working on FreeBSD? Message-ID: <200205121859.51217@que.te.den.dos.bellotas> this is Erlang/OTP 8.1 compiled from sources on FreeBSD 4.4 as far as I've seen os_mon works fine except for (erl40016@REDACTED)4> memsup:get_system_memory_data(). =ERROR REPORT==== 12-May-2002::18:59:18 === Error in process <0.76.0> on node 'erl40016@REDACTED' with exit value: {{badmatch,{#integer(2) = {49152,7327},#integer(2) = {16384,8014}}},[{memsup_helper,get_system_memory_usage,1},{memsup_helper,loop,2}]} =SUPERVISOR REPORT==== 12-May-2002::18:59:18 === Supervisor: {<0.75.0>,memsup_helper} Context: child_terminated Reason: {{badmatch,{480231424,525221888}}, [{memsup_helper,get_system_memory_usage,1}, {memsup_helper,loop,2}]} Offender: [{pid,<0.76.0>},{mod,memsup_helper}] =ERROR REPORT==== 12-May-2002::18:59:18 === ** Generic server <0.75.0> terminating ** Last message in was {'EXIT',<0.76.0>, {{badmatch,{480231424,525221888}}, [{memsup_helper,get_system_memory_usage,1}, {memsup_helper,loop,2}]}} ** When Server state == {state,memsup_helper, undefined, <0.76.0>, {<0.75.0>,memsup_helper}} ** Reason for termination == ** {{badmatch,{480231424,525221888}}, [{memsup_helper,get_system_memory_usage,1},{memsup_helper,loop,2}]} =CRASH REPORT==== 12-May-2002::18:59:18 === crasher: pid: <0.75.0> registered_name: [] error_info: {{badmatch,{480231424,525221888}}, [{memsup_helper,get_system_memory_usage,1}, {memsup_helper,loop,2}]} initial_call: {gen,init_it, [gen_server, <0.73.0>, <0.73.0>, supervisor_bridge, [memsup_helper,[],self], []]} ancestors: [os_mon_sup,<0.72.0>] messages: [] links: [<0.73.0>] dictionary: [] trap_exit: true status: running heap_size: 233 stack_size: 23 reductions: 148 neighbours: =SUPERVISOR REPORT==== 12-May-2002::18:59:18 === Supervisor: {local,os_mon_sup} Context: child_terminated Reason: {{badmatch,{480231424,525221888}}, [{memsup_helper,get_system_memory_usage,1}, {memsup_helper,loop,2}]} Offender: [{pid,<0.75.0>}, {name,memsup_helper_sup}, {mfa,{memsup_helper,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] =PROGRESS REPORT==== 12-May-2002::18:59:18 === supervisor: {<0.88.0>,memsup_helper} started: [{pid,<0.89.0>},{mfa,{memsup_helper,init,[[]]}}] =PROGRESS REPORT==== 12-May-2002::18:59:18 === supervisor: {local,os_mon_sup} started: [{pid,<0.88.0>}, {name,memsup_helper_sup}, {mfa,{memsup_helper,start_link,[]}}, {restart_type,permanent}, {shutdown,2000}, {child_type,worker}] ** exited: {timeout,{gen_server,call,[memsup,get_system_memory_data]}} ** memsup:get_memory_data/0 works: (erl40016@REDACTED)5> memsup:get_memory_data(). {525221888,479645696,{<0.23.0>,284704}} is this known? is this a bug? should I report it as such? -Daniel From joe@REDACTED Mon May 13 10:36:01 2002 From: joe@REDACTED (Joe Armstrong) Date: Mon, 13 May 2002 10:36:01 +0200 (CEST) Subject: Erlang communities and Activities report Message-ID: Hi everybody, I'd like to *voluteer* to edit and keep alive a "Erlang Communities and Activities Report" (something like the haskell thingy at http://www.haskell.org/communities/05-2002/html/report.html) I intend to publish this 4 times year. Please send me an e-mail telling me what your working on - mark the subject line - "Erlang report" and post it to me The email should have: 1) Your name + e-mail address 2) Project title 3) Project description 4) A URL 5) Other infomation I will edit together everything you send me and see that it gets published. /joe From vlad_dumitrescu@REDACTED Mon May 13 10:50:21 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Mon, 13 May 2002 10:50:21 +0200 Subject: erl_interface Message-ID: Kent wrote: >I daily feel that we let you, OpenSource users, down not being active >enough on the mailing list, not updating www.erlang.org often enough, >not thanking for the valuable patches and bug reports enough, not >adding your sent patches fast enough and not providing new >intermediate releases often enough. We also sit on the documentation >system and the test server that should have been released as >OpenSource years ago. >We are strongly determined to support the OpenSource version of >Erlang/OTP the best way we can. And I hope that you will continue >to help us improve Erlang/OTP, I for one (and I bet all other OpenSourcers do the same) understand the situation all too well, and appreciate all the effort that the OpenSource version requires. There is a price to pay for having the official Erlang/OTP under Ericsson control, but I never resented that as a problem: on the contrary, the advantage is getting commercial grade software! Thank you and keep up the good work. regards, Vlad _________________________________________________________________ Skicka och ta emot Hotmail-meddelanden p? din mobilenhet: http://mobile.msn.com From joe@REDACTED Mon May 13 11:26:17 2002 From: joe@REDACTED (Joe Armstrong) Date: Mon, 13 May 2002 11:26:17 +0200 (CEST) Subject: Erlang communities and Activities report In-Reply-To: Message-ID: The page describing everything is at http://erlang.sics.se/projects.html It now has two entries ... /Joe > > Hi everybody, > > I'd like to *voluteer* to edit and keep alive a > "Erlang Communities and Activities Report" (something like the haskell > thingy at http://www.haskell.org/communities/05-2002/html/report.html) > > I intend to publish this 4 times year. > > Please send me an e-mail telling me what your working on - mark the > subject line - "Erlang report" and post it to me > > The email should have: > > 1) Your name + e-mail address > 2) Project title > 3) Project description > 4) A URL > 5) Other infomation > > I will edit together everything you send me and see that it gets > published. > > /joe > > > From matthias@REDACTED Mon May 13 12:09:33 2002 From: matthias@REDACTED (Matthias Lang) Date: Mon, 13 May 2002 12:09:33 +0200 Subject: ANN: Haskell Communities and Activities Report (2nd edition) In-Reply-To: References: Message-ID: <15583.37085.296712.269494@antilipe.corelatus.se> C.Reinke writes: > The 2nd edition of the Haskell Communities and Activities Report > is now available (PDF,Postscript,HTML) at: > http://www.haskell.org/communities/ [...] > I would very much like to see a similar effort in the Erlang > Community (or does it exist already?). There are two places where this information is collected: http://dmoz.org/Computers/Programming/Languages/Erlang/ http://www.erlang.org/links.html The former is pretty comprehensive (it lists most of the projects you wondered about), the latter is a little more selective. Matthias From etxuwig@REDACTED Mon May 13 14:35:14 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 13 May 2002 14:35:14 +0200 (MET DST) Subject: download stats Message-ID: I noticed that the latest download statistics are available att http://www.erlang.org. I like the trend, but pages 1 and 2 should really change places in the document. Page 2 is clearer and more impressive. More than 10,000 downloads/month! Considering that the Windows R8 binary is > 23 MB, I'm assuming people aren't pulling it down just to keep the numbers up. When I first came across Erlang, you could almost learn the names of all active Erlang users... (: /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From L.A.Timochouk@REDACTED Mon May 13 15:04:47 2002 From: L.A.Timochouk@REDACTED (Leonid Timochouk) Date: Mon, 13 May 2002 14:04:47 +0100 (BST) Subject: Memory management options Message-ID: Hello Erlang users, I have some questions about memory-related options of "beam": (1) It is said that "sl_alloc" may allocate short-living blocks in "mmap"ed areas. What is the advantage of doing this? (2) The "+s" option allows us to set the stack size of Erlang processes, but how to read back the default stack size? "erlang:system_info" does not seem to report this figure. (3) The "+h" option sets the heap size for processes. Again, how to read it back? And most important, is it the single heap size for all processes, or a per-process one? (4) Do all these "+" options allow/require a space between the option key and the argument? The "+A" option does not have a space... Best wishes, Dr. L.A.Timochouk Computing Laboratory University of Kent at Canterbury From cpressey@REDACTED Mon May 13 15:35:58 2002 From: cpressey@REDACTED (Chris Pressey) Date: Mon, 13 May 2002 08:35:58 -0500 Subject: user interface Message-ID: <20020513083558.514cb536.cpressey@catseye.mb.ca> Hi again all, Sorry I've been busy and out of touch the past while. I bear bad news, and a conclusion drawn from it which is unflattering. The bad news is that the GS backend completely and utterly fails to work on Windows ME. It's quite probable you already know this. And I completely agree that the bug in this instance is that my boss is, for no good reason, running Windows ME. But I'm not quite in a position to talk him out of it. So, if you really want to make my day (even though I am not a paying customer, for shame, I don't even use EMACS or own a cell phone,) you can start by telling me that R9 is coming out soon and that it ships with an updated GS that uses Tcl/Tk 8 as its backend and that that backend doesn't crash when run under Windows ME. Or, I'm going to have to start figuring out how to use erlgtk, and assuming it doesn't crash under ME, switch my code over to it. My conclusion is that Erlang/OTP's biggest weakness is in user interface. There is a fourfold increase in productivity, true. But if your application happens to be GS-intensive, and is being asked to run under Windows, it will pretty much be cancelled out by a fourfold decrease in stability. Other UI options seem to be balked at every step. The difficulty in talking to the terminal directly was pointed out by the other Chris; my only thought on this is that it might be possible using the file module, but as far as I know there is no (simple) way to get the standard output handle. I find it ironic that, despite the inability to send non-printable characters to the terminal to invoke display functions, Erlang still requires curses to build, presumably for the fancy bracket-cursor-basketball game in the shell. (As an aside: the shell is so ugly I wouldn't miss it if it disappeared. But that's entirely another topic of conversation :) There's Slang, but no build of Slang for Erlang for Windows, as far as I'm aware, and building one is beyond my present capabilities. Sure, some will say that what should be used for the user interface is the web browser. While this is nicely portable and remote-controllable, there is a huge drawback. Unlike Erlang, HTTP is NOT soft real-time. There is no real interactivity; each form is a batch submission. This results in a huge impedance mismatch, as it were, with the message-passing paradigm, and I don't see it being very appropriate for anything but the most rudimentary configuration tasks. Not for continual interactive use. Stability and paradigm-applicability (that is, matching Erlang's soft-real-time-ness) on as many platforms as possible is, I think, a reasonable goal for the user interface; and with that in mind, I think it would probably be best to find a robust backend and concentrate on it. erlgtk may prove to be such a thing. If it is, then I think it would be wise to rewrite GS, or at least a large subset of GS, using erlgtk as its new backend. Thanks in advance for any thoughts you might like to contribute on this subject. -Chris From Erik.Reitsma@REDACTED Mon May 13 15:51:33 2002 From: Erik.Reitsma@REDACTED (Erik Reitsma (ELN)) Date: Mon, 13 May 2002 15:51:33 +0200 Subject: user interface Message-ID: > Other UI options seem to be balked at every step. How about using JInterface, making the GUI in Java? I have been through interviews -> tcl -> gs. When there was a direct interface to tcl, I wrote most of the UI code in Tcl/Tk, and all the real work in Erlang. Now we are planning to port the Tcl/Tk stuff to Java, because our tcl code is for some real old tcl version, which is not very stable (anymore?): it crashes unexpectedly... Hopefully (?) Java will be around for a while, so for UI stuff that would be my first choice. But I have to admit that I have not looked deep into the more recent Erlang GUI initiatives. It's just that we had the GUI code outside Erlang anyway, because it predates gs. *Erik. From C.Reinke@REDACTED Mon May 13 17:02:04 2002 From: C.Reinke@REDACTED (C.Reinke) Date: Mon, 13 May 2002 16:02:04 +0100 Subject: ANN: Haskell Communities and Activities Report (2nd edition) In-Reply-To: Message from Matthias Lang of "Mon, 13 May 2002 12:09:33 +0200." <15583.37085.296712.269494@antilipe.corelatus.se> Message-ID: > > http://www.haskell.org/communities/ > > > I would very much like to see a similar effort in the Erlang > > Community (or does it exist already?). > > There are two places where this information is collected: > > http://dmoz.org/Computers/Programming/Languages/Erlang/ > http://www.erlang.org/links.html > > The former is pretty comprehensive (it lists most of the projects you > wondered about), the latter is a little more selective. Okay, so what's that Bluetail link on the second site? Where is the new Erlang book? What/when was the last change to the Erlang type system, and who is using it? Have you tried to follow the link to the birthplace of Erlang on the first site? When/how did you hear about the section "Media Articles on Products" in one of the collections? How often do you check for updates? To how many of the Erlang-related mailing lists, wikis, and web-forums are you subscribed? As I said, the suggested report is a complement to existing websites. In the Haskell case, it complements the Haskell home page at , which should have links to everything Haskell. The report is *not* meant as yet another link collection - it collects brief summaries of _recent activities_ with links to further details (where sensible, those links lead to the relevant parts of the link collections). No recent activities, no entry here. Btw, the editors of those link collections offer a service to their community, but the community all too often assumes that those sites are self-maintaining.. If you wanted to derive the same benefit as you could expect from the reports from the sites you mentioned, you would have to a) make a note in your diary to check all Erlang projects every n months b) when the item comes up, search the link collections, (add a google search, in case anything is missing), follow each of the links (if they still work), find the what's new page (if such a thing exists and is up to date) c) document your findings This is a simplified list, but even so you can see that 1. it makes more sense to do this only once per survey date (instead of once per date and Erlang user) and share the results. 2. it makes more sense to broadcast the survey, have small parts of the text be prepared in a distributed fashion, by those who know most about the projects, and collect the results at the end, to provide a synchronisation point and to give everyone a consistent snapshot. Distributed computation of a distributed problem, with the report editor trying to act as supervisor. (in the Haskell case, I remind former contributors 3 weeks before the deadline, send a general call for contributions to the main mailing list 2 weeks before the deadline, and numerous reminders and personal invitations till the last minute; I immediately edit incoming contributions into the whole, make the draft report available to the contributors in the week between deadline and release, and release the whole to everyone when things have settled down; all the time, there is an open list of projects covered, so that everyone can see where additional volunteers are still needed) Think of it as Heartbeat Monitoring of the Erlang Communities;-) A welcome side-effect is that contributors feel inclined to update their webpages for the reports, and that everyone knows who felt responsible for a given project at the time of the last report. The maintainers of the two sites you mention will confirm that it is otherwise really difficult to get people to keep their entries in the link collections up to date. Somehow, everyone expects them to do all the work.. (you'll probably find that they still won't get updates directly, but at least the reports help them to keep their collections up to date). Great to hear that Joe has volunteered! Joe's current concern as the new editor will be to get a first list of projects, so the first edition might look a bit like a link collection with added summaries. The difference will become more apparent starting with the first update. Of course, the Erlang community will have their own preferences on what to include and how to organize things (e.g., quarterly reports instead of half-yearly ones;-), but one thing doesn't change: if you think these regular reports are a good idea, you should support your editor! For every project, only one of the project members needs to volunteer to write only a few sentences/paragraphs, and Joe will have his hands full editing everything together and keeping his mailbox organised!-) Good luck with your reports. I'm looking forward to the first edition! Cheers, Claus PS. For comparison, here is an interesting alternative with even more frequent (necessarily shorter) reports: http://www.freebsd.org/news/status/status.html From rickard.green@REDACTED Mon May 13 17:28:50 2002 From: rickard.green@REDACTED (Rickard Green) Date: Mon, 13 May 2002 17:28:50 +0200 Subject: Memory management options References: Message-ID: <3CDFDBB2.7285FA0@uab.ericsson.se> Leonid Timochouk wrote: > > Hello Erlang users, > > I have some questions about memory-related options of "beam": > > (1) It is said that "sl_alloc" may allocate short-living blocks in > "mmap"ed areas. What is the advantage of doing this? > Erlang heaps are repeatedly moved due to copying garbage collection. When these "short lived" memory blocks repeatedly are moved on the emulator heap they have a tendency to fragment the emulator heap (the heap of the unix process in which the emulator is run). Especially large Erlang heaps can cause the emulator heap to grow very much. By placing short lived memory blocks outside of the emulator heap (in mmap()ped segments), the fragmentation of the emulator heap will be reduced. The erl(1) and sl_alloc(3) man pages (R8B-1) can give you some more information. > (2) The "+s" option allows us to set the stack size of Erlang processes, > but how to read back the default stack size? "erlang:system_info" > does not seem to report this figure. This option was removed when jam was removed (R6). The documentation of it should have been removed then, but it wasn't. It will be removed in the next patch. > > (3) The "+h" option sets the heap size for processes. Again, how to read > it back? And most important, is it the single heap size for all > processes, or a per-process one? "erlang:process_info(Pid, heap_size)" gives the current heap size of the process referred to by Pid. This heap contains both the heap and the stack of the process. The heap grows from the bottom up towards the stack and vice versa. > > (4) Do all these "+" options allow/require a space between the option > key and the argument? The "+A" option does not have a space... > + options do allow but do not require white-space. Due to a bug some options (e.g. +A 10) used to fail when option key and argument were separated by white-space, though. This bug has been fixed in R8B-1. > Best wishes, > > Dr. L.A.Timochouk > Computing Laboratory > University of Kent at Canterbury Best regards, Rickard Green, Erlang/OTP From kent@REDACTED Mon May 13 19:03:52 2002 From: kent@REDACTED (Kent Boortz) Date: 13 May 2002 19:03:52 +0200 Subject: user interface In-Reply-To: <20020513083558.514cb536.cpressey@catseye.mb.ca> References: <20020513083558.514cb536.cpressey@catseye.mb.ca> Message-ID: Chris Pressey writes: > So, if you really want to make my day (even though I am not a paying > customer, for shame, I don't even use EMACS or own a cell phone,) you can > start by telling me that R9 is coming out soon and that it ships with an > updated GS that uses Tcl/Tk 8 as its backend and that that backend doesn't > crash when run under Windows ME. I can't tell you all that but something is done to move there. I have just been working with moving GS to Tcl/Tk 8.3.4 on Unix and Tcl/Tk 8.3.2 on Windows for a couple of days. - I have rewritten the font handling to use the Tk 8 font model. - For the OpenSource version the Tcl/Tk sources will no longer be part of the Erlang/OTP TAR source package. Instead the system wide installation of Tcl/Tk will be used. Tcl/Tk binaries will be part of commercial releases and the Windows release. I have rewritten configure scripts, make files etc to make this happen. - I have rewritten the port program used on Unix to conform to a more "normal" use of the Tcl/Tk C API. - I have made the Windows specific changes but this is not tested. - I use my own Tcl/Tk port program "stand alone" approach for commercial releases, I initiate Tcl/Tk to use the startup files in "$ERLTOP/lib/gs/priv/lib/". GS is very complex so I try to port it without changing to much. What I know I have to do is - Do a lot of testing ;-) There are many small changes not even documented between the Tcl/Tk versions. - I have to test it on Windows (I'm not a Windows person so this may take some time). - I have to find out how to change Tk 8 to wrap text at "\n" in labels. This worked in Tk 4.2 and some GS apps depends on it. - The old GS wrote strings to a hidden window to find out the width needed to display the text in a container. I try to use "font measure $fontspec" but if I can get the "\n" working I need to define a tcl function that calculate the longest line in a string (if someone is good at tcl you are welcome to help me out ;-). I know that this is probably not the right way to go but as I said, I don't want to rewrite all of GS. - I have started coding for using the new top menu handling in Tk 8, i.e. to get native look and feel for the top menus. I hope to get it out for Unix testing in the P9 snapshots later this week if everything goes well. kent From L.A.Timochouk@REDACTED Tue May 14 14:25:22 2002 From: L.A.Timochouk@REDACTED (Leonid Timochouk) Date: Tue, 14 May 2002 13:25:22 +0100 (BST) Subject: File locking & device drivers Message-ID: Hello Erlang users, I am trying to implement a file locking capability (an interface to the "flock" system call) in Erlang. Unfortunately, the "file" module does not provide it straight away. My first approach was to build a linked-in device driver, and it works almost fine (it uses "flock" in non-blocking mode in order not to block the whole Erlang node). There is a problem, however: it communicates with the Erlang code by sending messages, and the driver responses come into the same main message queue of the calling process. Now, suppose we have a process which reads incoming data from its message queue and writes them into a file, locking the file each time. Then the whole message queue would need to be traversed each time by the run-time system when we try to fetch the driver responses, so saving messages in a file has QUADRATIC rather than linear complexity w.r.t. the length of the incoming queue. This is a major inefficiency. Would modifying the built-in "efile" driver be a better solution? If so, should "flock" be implemented via "file_output" or "file_outputv"? Why is, for example, "close" implemented as a "file_outputv" operation, although it has no "vector" data to deal with? Any guidance to "efile" driver internals will be very much appreciated. Sincerely, Dr. Leonid Timochouk Computing Laboratory University of Kent at Canterbury From etxuwig@REDACTED Tue May 14 16:36:18 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 14 May 2002 16:36:18 +0200 (MET DST) Subject: bad HTML? Message-ID: Is it just my Netscape, or is the HTML doc for 'erlang' in R8B badly formatted? http://www.erlang.org/doc/r8b/lib/kernel-2.7.2/doc/html/erlang.html /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From peter@REDACTED Tue May 14 17:40:03 2002 From: peter@REDACTED (Peter H|gfeldt) Date: Tue, 14 May 2002 17:40:03 +0200 (MET DST) Subject: bad HTML? In-Reply-To: Message-ID: I suppose you mean that the indentation increases as you move down the `erlang' page. MSIE does not show that behaviour, so it is probably an error in Netscape's use of cascading style sheet info. We will look into the matter more thoroughly. /Peter On Tue, 14 May 2002, Ulf Wiger wrote: > > Is it just my Netscape, or is the HTML doc for 'erlang' in R8B > badly formatted? > > http://www.erlang.org/doc/r8b/lib/kernel-2.7.2/doc/html/erlang.html > > /Uffe > -- > Ulf Wiger, Senior Specialist, > / / / Architecture & Design of Carrier-Class Software > / / / Strategic Product & System Management > / / / Ericsson Telecom AB, ATM Multiservice Networks > From willem@REDACTED Tue May 14 17:51:06 2002 From: willem@REDACTED (Willem Broekema) Date: Tue, 14 May 2002 17:51:06 +0200 Subject: bad HTML? References: Message-ID: <3CE1326A.8080603@pastelhorn.com> Ulf Wiger wrote: > Is it just my Netscape, or is the HTML doc for 'erlang' in R8B > badly formatted? > > http://www.erlang.org/doc/r8b/lib/kernel-2.7.2/doc/html/erlang.html The HTML is valid (well, apart from a missing Character encoding - see ). Mozilla displays it fine. If you mean the unintended indentations of 'hd(List)' and below (using Netscape 4.73/Win): Netscape is probably confused by the unclosed P tags. - Willem From etxuwig@REDACTED Tue May 14 16:33:24 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 14 May 2002 16:33:24 +0200 (MET DST) Subject: File locking & device drivers In-Reply-To: Message-ID: On Tue, 14 May 2002, Leonid Timochouk wrote: >Hello Erlang users, > >I am trying to implement a file locking capability (an interface >to the "flock" system call) in Erlang. Unfortunately, the "file" >module does not provide it straight away. > >My first approach was to build a linked-in device driver, and it >works almost fine (it uses "flock" in non-blocking mode in order >not to block the whole Erlang node). There is a problem, >however: it communicates with the Erlang code by sending >messages, and the driver responses come into the same main >message queue of the calling process. Now, suppose we have a >process which reads incoming data from its message queue and >writes them into a file, locking the file each time. Then the >whole message queue would need to be traversed each time by the >run-time system when we try to fetch the driver responses, so >saving messages in a file has QUADRATIC rather than linear >complexity w.r.t. the length of the incoming queue. This is a >major inefficiency. Still, if you use driver_send_term() to send the reply directly to the client (which can be identified through driver_caller()). You can also register the driver instance through the normal register/2 BIF. This way, the caller doesn't have to know the port ID. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From kent@REDACTED Tue May 14 18:35:46 2002 From: kent@REDACTED (Kent Boortz) Date: 14 May 2002 18:35:46 +0200 Subject: bad HTML? In-Reply-To: References: Message-ID: Ulf Wiger writes: > Is it just my Netscape, or is the HTML doc for 'erlang' in R8B > badly formatted? > > http://www.erlang.org/doc/r8b/lib/kernel-2.7.2/doc/html/erlang.html No, good HTML :-) I changed the documentation (actually the SGML to HTML translator) to conform to the standard "4.01 Transitional". The right way to indent text in this standard is to use cascade styling sheets, CSS. Netscape 4 does a poor job handling this. Sometimes, not alway, if an indented DIV section contains a table Netscape don't leave the indentation when the DIV is ended. I haven't found a good solution yet. Using UL without LI to indent as before is not right according to the standard. Using BLOCKQUOTE is not right, it may give visual effect like a yellow background or slanted text in some browsers, using tables with hidden transparant gif files is the common way to do this but it is the wrong way for lynx users or blind people. I have asked for help in the news group comp.infosystems.www.authoring.html but got no good answer. Netscape is just broken and I have to find a way around this. This was probably more than you wanted to know.... ;-) kent From cpressey@REDACTED Tue May 14 22:41:29 2002 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 14 May 2002 15:41:29 -0500 Subject: user interface In-Reply-To: References: <20020513083558.514cb536.cpressey@catseye.mb.ca> Message-ID: <20020514154129.59d80f66.cpressey@catseye.mb.ca> On 13 May 2002 19:03:52 +0200 Kent Boortz wrote: > > Chris Pressey writes: > > So, if you really want to make my day (even though I am not a paying > > customer, for shame, I don't even use EMACS or own a cell phone,) you > > can start by telling me that R9 is coming out soon and that it ships > > with an updated GS that uses Tcl/Tk 8 as its backend and that that > > backend doesn't crash when run under Windows ME. > > I can't tell you all that but something is done to move there. I have > just been working with moving GS to Tcl/Tk 8.3.4 on Unix and Tcl/Tk > 8.3.2 on Windows for a couple of days. This is excellent news. Thank you. Out of curiousity, any reason not to use Tcl/Tk 8.3.3 on Windows? (At least I am fairly confident 8.3.x will not completely and utterly crash on Windows ME, and that is the most important aspect for me personally.) > - I have to test it on Windows (I'm not a Windows person so this > may take some time). I can help, probably not thoroughly, but I will be one Erlang user who will be using GS fairly intensively under Windows. If something doesn't work, you'll hear about it :) On a few related notes. I tried erlgtk for Windows, but the archive http://www.bluetail.com/~luke/misc/erlgtk-0.9.0.zip does not seem to include the lib*.hrl files (which are presumably generated automatically by the makefile, from OS-specific constants, found in C language headers). So, I could only get about six of the less impressive gtk examples to compile on Windows. Using another language simply for its GUI capabilities is something I'd rather avoid if possible, unless perhaps that language is specifically for GUI. So, I'm not very interested in using Java. I've never really liked Tcl either, but it's a bit unavoidable when using Tk (although GS hides this nicely (although this is probably what makes GS so complex)). I briefly considered Visual BASIC, but it doesn't seem to have a concept of standard input/output or file handles, so writing a port program in it would probably be more work than it's worth. I still think a GS-compatible interface to erlgtk would be nice, and possibly even a feasible project someday, once I achieve some fluency in gtk. Thanks for all the info. -Chris From vlad_dumitrescu@REDACTED Wed May 15 00:30:34 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 15 May 2002 00:30:34 +0200 Subject: user interface Message-ID: Chris wrote: >Using another language simply for its GUI capabilities is something I'd >rather avoid if possible, unless perhaps that language is specifically for >GUI. So, I'm not very interested in using Java. I've never really liked >Tcl either, but it's a bit unavoidable when using Tk (although GS hides >this nicely (although this is probably what makes GS so complex)). I >briefly considered Visual BASIC, but it doesn't seem to have a concept of >standard input/output or file handles, so writing a port program in it >would probably be more work than it's worth. Hi, Maybe it is a little out of topic, but there is an important difference between using Tcl/Tk via GS and Java as GUI builders. For a closer match, there would be a Java server that one could send commands from Erlang (like, "create a text box with these params") all nicely packaged just as GS. As a matter of fact, such a Java server might even serve as a backend for GS... I feel the same that using Java to build a GUI and using Erlang only for non-visual stuff is a little kludgy... the GUI is also part of the application, and I like to keep things on the Erlang side :-) What was the point with my note, you ask? How should I know? :-) I think that I just realized myself that one could in principle write a Java backend for GS, and then extend it to take advantage of all whistle-and-bells of a Java GUI... sounds interesting enough, I think. But it will take a lot of work... good night now, Vlad _________________________________________________________________ H?mta MSN Explorer kostnadsfritt p? http://explorer.msn.se/intl.asp From kent@REDACTED Wed May 15 02:23:50 2002 From: kent@REDACTED (Kent Boortz) Date: 15 May 2002 02:23:50 +0200 Subject: user interface In-Reply-To: <20020514154129.59d80f66.cpressey@catseye.mb.ca> References: <20020513083558.514cb536.cpressey@catseye.mb.ca> <20020514154129.59d80f66.cpressey@catseye.mb.ca> Message-ID: Chris Pressey writes: > Out of curiousity, any reason not to use Tcl/Tk 8.3.3 on Windows? (At > least I am fairly confident 8.3.x will not completely and utterly crash on > Windows ME, and that is the most important aspect for me personally.) ActiveState has changed the license between 8.3.2 and 8.3.3. We are not allowed to redistribute binaries. Erlang/OTP OpenSource binary distribution for Windows is exactly the same as the commercial one and we prefer not to require a separate download and installation of Tcl/Tk before installing Erlang/OTP. But this may be possible to solve somehow later on, I just don't have time to look into this at the moment. I don't use a wrapper so you can manually replace the Tcl/Tk 8.3.2 parts with 8.3.4 until this issue is solved. > > - I have to test it on Windows (I'm not a Windows person so this > > may take some time). > > I can help, probably not thoroughly, but I will be one Erlang user who > will be using GS fairly intensively under Windows. If something doesn't > work, you'll hear about it :) I have run into trouble and this will take longer than expected. I have problems that seem to be deep inside the Tk imlementation and I have to understand what is going on and find a way around it. Takes lots of time to figure out I think :-( > I still think a GS-compatible interface to erlgtk would be nice, and > possibly even a feasible project someday, once I achieve some fluency in > gtk. This is a complete rewrite of GS I think. It has a front end and back end but it smells Tcl/Tk all over the code. You may like GS or not but it is quite impressive the amount of work put into coding GS from the original authors. kent From lennart.ohman@REDACTED Wed May 15 09:29:39 2002 From: lennart.ohman@REDACTED (=?iso-8859-1?Q?Lennart__=D6hman?=) Date: Wed, 15 May 2002 09:29:39 +0200 Subject: Erlang mentioned in Ericsson Contact Message-ID: Hi! Find two occurrancies of the word "Erlang"! (No price to the winner, sorry ;-) http://www.ericsson.com/about/publications/kon_con/contact/contarc/pdf/c08_0 2/21.pdf /Lennart From etxuwig@REDACTED Wed May 15 12:00:14 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 15 May 2002 12:00:14 +0200 (MET DST) Subject: bad HTML? In-Reply-To: Message-ID: On 14 May 2002, Kent Boortz wrote: >I changed the documentation (actually the SGML to HTML >translator) to conform to the standard "4.01 Transitional". The >right way to indent text in this standard is to use cascade >styling sheets, CSS. Netscape 4 does a poor job handling this. >Sometimes, not alway, if an indented DIV section contains a >table Netscape don't leave the indentation when the DIV is >ended. > >I haven't found a good solution yet. Using UL without LI to >indent as before is not right according to the standard. Using >BLOCKQUOTE is not right, it may give visual effect like a yellow >background or slanted text in some browsers, using tables with >hidden transparant gif files is the common way to do this but it >is the wrong way for lynx users or blind people. > >I have asked for help in the news group >comp.infosystems.www.authoring.html but got no good answer. >Netscape is just broken and I have to find a way around this. > >This was probably more than you wanted to know.... ;-) > >kent No, it was exactly the right amount. ;) I didn't follow the part about transparent gifs being wrong for blind people, but I'm sure that's way off-topic. BTW, apologies for not being more specific about what problem I was referring to. It was indeed the indendation problem in Netscape 4. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From raimo@REDACTED Wed May 15 12:18:50 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Wed, 15 May 2002 12:18:50 +0200 Subject: File locking & device drivers References: Message-ID: <3CE2360A.E4559B22@erix.ericsson.se> Leonid Timochouk wrote: > > Hello Erlang users, > > I am trying to implement a file locking capability (an interface to the > "flock" system call) in Erlang. Unfortunately, the "file" module does not > provide it straight away. > > My first approach was to build a linked-in device driver, and it works > almost fine (it uses "flock" in non-blocking mode in order not to block > the whole Erlang node). There is a problem, however: it communicates with > the Erlang code by sending messages, and the driver responses come into > the same main message queue of the calling process. Now, suppose we have a > process which reads incoming data from its message queue and writes them > into a file, locking the file each time. Then the whole message queue > would need to be traversed each time by the run-time system when we try to > fetch the driver responses, so saving messages in a file has QUADRATIC > rather than linear complexity w.r.t. the length of the incoming queue. > This is a major inefficiency. > Is this not more of a general flow control problem. Asynchronous message passing is THE way to synchronize processes in Erlang. If you have a server that passes messages to somewhere (a file while guarding all writes with 'flock') and many clients just feeding the server (no request/reply message passing), the server message queue might grow in this case affecting the server's ability to serve requests since these client messages gets in the way of more important messages. There is a mechanism in the Erlang emulator (virtual machine) that compensates for this problem. A process that sends a message to another process with a large message queue gets punished with getting sheduled out sooner. This mechanism diminsishes this producer/consumer problem. Another way to get efficient data dumping to a file would be to write a driver that does almost all of the work. I think it was this track Ulf Wiger was on in his earlier reply. If all producers (clients) would write to a port (with a registered name), the port could queue the requests as it wished, or just call 'set_busy_port(port, !0)' when it has enough buffered for the moment. Any process writing to a port that is busy gets suspended in the write ('erlang:port_command(Port, Data)'), so no receive queue would have to be examined for a response. > Would modifying the built-in "efile" driver be a better solution? If so, > should "flock" be implemented via "file_output" or "file_outputv"? Why is, > for example, "close" implemented as a "file_outputv" operation, although > it has no "vector" data to deal with? Any guidance to "efile" driver > internals will be very much appreciated. > You would probably not gain any performance by modifying the 'efile' driver, since it cannot do anything better than your driver. All operations should be implemented in 'file_outputv' just because it exists. The ones in 'file_output' is just waiting for the driver responsible to get time to move them over. These functions ('file_outputv' and 'file_output') are part of the interface between the emulator and the driver, and since the outputv variant exists it is always called. 'file_outputv' flattens the buffer vector and calls 'file_output' itself when for the requests not yet moved over (slightly inefficient). The function 'file_outputv' gets vectorised data from the emulator, which is most beneficial for the writev and readv operations. / Raimo Niskanen, Erlang/OTP, Ericsson AB From matthias@REDACTED Wed May 15 13:00:43 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 15 May 2002 13:00:43 +0200 Subject: are R7 .beam files compatible with the R8 VM? Vice versa? Message-ID: <15586.16347.592853.918973@antilipe.corelatus.se> Hi, .beam files compiled on R7 seem to work on R8, but is this guaranteed to work? (I went and recompiled everything, just in case, but now I'm wondering if that was necessary). Matthias From francesco@REDACTED Wed May 15 13:24:21 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Wed, 15 May 2002 12:24:21 +0100 Subject: Erlang communities and Activities report References: Message-ID: <3CE24565.7010202@erlang-consulting.com> As Matthias mentioned, there is a comprehensive list of Erlang links at http://dmoz.org/Computers/Programming/Languages/Erlang/ It contains projects, products (ongoing and terminated), research, commercial support, articles, thesis, conferences, contributions, and all links relating to Erlang I was able to find. There are a couple hundred links right now, which should approach 300 as soon as I have a couple of days over to add them. Until then, if you have any links feel free to add them yourself in the add section or email them to me (The latter might take longer to include them). Regards, Francesco -- http://www.erlang-consulting.com Joe Armstrong wrote: >Hi everybody, > >I'd like to *voluteer* to edit and keep alive a >"Erlang Communities and Activities Report" (something like the haskell >thingy at http://www.haskell.org/communities/05-2002/html/report.html) > >I intend to publish this 4 times year. > >Please send me an e-mail telling me what your working on - mark the >subject line - "Erlang report" and post it to me > >The email should have: > >1) Your name + e-mail address >2) Project title >3) Project description >4) A URL >5) Other infomation > >I will edit together everything you send me and see that it gets >published. > >/joe > > > > From raimo@REDACTED Wed May 15 13:43:55 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Wed, 15 May 2002 13:43:55 +0200 Subject: are R7 .beam files compatible with the R8 VM? Vice versa? References: <15586.16347.592853.918973@antilipe.corelatus.se> Message-ID: <3CE249FB.E06CE054@erix.ericsson.se> It was not necessary to recompile. I have not tried, but R5 .beam files should still run on R9 when it is released. It is our intention to keep backwards compatibility for .beam files, but one day we might have to break this habit. In that case we will let you know. Read the release notes. / Raimo Matthias Lang wrote: > > Hi, > > .beam files compiled on R7 seem to work on R8, but is this guaranteed to > work? (I went and recompiled everything, just in case, but now I'm > wondering if that was necessary). > > Matthias From C.Reinke@REDACTED Wed May 15 19:34:18 2002 From: C.Reinke@REDACTED (C.Reinke) Date: Wed, 15 May 2002 18:34:18 +0100 Subject: Erlang communities and Activities report In-Reply-To: Your message of "Wed, 15 May 2002 12:24:21 BST." <3CE24565.7010202@erlang-consulting.com> Message-ID: > As Matthias mentioned, there is a comprehensive list of Erlang links at > > http://dmoz.org/Computers/Programming/Languages/Erlang/ > > It contains projects, products (ongoing and terminated), research, > commercial support, articles, thesis, conferences, contributions, and > all links relating to Erlang I was able to find. There are a couple > hundred links right now, which should approach 300 as soon as I have a > couple of days over to add them. Until then, if you have any links feel > free to add them yourself in the add section or email them to me (The > latter might take longer to include them). And just to clear up a potential misunderstanding that someone has pointed out to me off-list: my suggestions were not directed against this useful resource, nor against the collection at erlang.org. I was just pointing out that a combination of such reference collections and regular surveys/reports would be even more useful, and that both represent services to the community that need everyone's support to work well. Of course, I don't know how Joe is going to organize the Erlang variant of the Activities Reports, but if it's going to be anything like the Haskell variant, the collections and reports are going to complement each other. They won't compete because they have different goals. One useful metaphor is that of journals/magazines and reference handbooks: the latter make poor reading on a train or plane, and you can't hand them to interested outsiders hoping they might get a good overview. The former aren't the first choice for looking up what you know must be somewhere, but you keep reading them when they come out to stay up to date with developments, and they are a useful starting point to get acquainted with a new field. So, please, support both kinds of effort: the editors can't guess what gems you're hiding on your disk, and your fellow programmers might just be waiting for that hobby horse you're riding every now and then, when you find the time. And once there is a regular report full of executive summaries of recent activities, perhaps you can show it to your boss or customer. Who knows, you might no longer have to hide your Erlang code and tuples by recoding in C++ and XML (if I recall that story from the Erlang User Conference correctly;-). Hth, Claus From C.Reinke@REDACTED Wed May 15 20:00:27 2002 From: C.Reinke@REDACTED (C.Reinke) Date: Wed, 15 May 2002 19:00:27 +0100 Subject: File locking & device drivers In-Reply-To: Your message of "Wed, 15 May 2002 12:18:50 +0200." <3CE2360A.E4559B22@erix.ericsson.se> Message-ID: > There is a mechanism in the Erlang emulator (virtual machine) that > compensates for this problem. A process that sends a message to another > process with a large message queue gets punished with getting sheduled > out sooner. This mechanism diminsishes this producer/consumer problem. That's a very useful bit of information. I don't think I've come across it in my reading of Erlang book/documentation, though. My first reaction was: great, that's the sensible thing to do. Then I wondered: wait a second, doesn't Erlang use *selective reading* of message queues? It wouldn't be great programming style, and I think it's explicitly recommended in the design guidelines to keep message queues clear, but what if that receiver with the large message queue is not busy processing the pending messages, but is waiting for that specific message to come in before dealing with the rest of the queue? Or, what if I have a server with several clients, one of which happens to be lacking behind in processing its input queue - should that really mean that the server gets scheduled out whenever it has sent to that problematic client? In brief: I think this scheduling behaviour should be documented very early on in the Erlang learning materials, together with rationale and consequences. Meanwhile, where could I find a description of the current scheduling behaviour (apart from the source;-)? I've seen it described as "fair", but there are different interpretations of fairness in this context, and some aspects will be Erlang-specific. Cheers, Claus From apeake@REDACTED Thu May 16 06:19:21 2002 From: apeake@REDACTED (Alex Peake) Date: Wed, 15 May 2002 21:19:21 -0700 Subject: Higher Order Function Question Message-ID: I have a function that in Lisp is defined: %(defun disjoin (fn &rest fns) % (if (null fns) % fn % (let ((disj (apply #'disjoin fns))) % #'(lambda (&rest args) % (or (apply fn args) (apply disj args)))))) % % or in Scheme: %(define (disjoin fn . fns) % (if (null? fns) % fn % (lambda (args) % (or (fn args) ((apply disjoin fns) args))))) I have tried the following (incorrect) Erlang: disjoin([Fn | FnTail]) -> fun(Args) -> apply(Fn, [Args]) orelse apply(apply(disjoin, [FnTail]), [Args]) end; disjoin([Fn]) -> Fn. Can anyone help please? Alex From thomas@REDACTED Thu May 16 09:12:45 2002 From: thomas@REDACTED (Thomas Arts) Date: Thu, 16 May 2002 09:12:45 +0200 Subject: Higher Order Function Question References: Message-ID: <3CE35BED.BA39BE26@cslab.ericsson.se> Hi Alex > disjoin([Fn | FnTail]) -> > fun(Args) -> > apply(Fn, [Args]) orelse apply(apply(disjoin, [FnTail]), [Args]) end; > disjoin([Fn]) -> > Fn. > > Can anyone help please? turn around the first and second clause. The first clause also matches disjoint([F]), since in that case FnTail is nil. /Thomas ps. You don't need to use three apply's, I guess you want to recursively apply disjoin on the rest of the functions: fun(Args) -> apply(Fn, [Args]) orelse apply(apply(disjoin, [FnTail]), [Args]) end; is equal to: fun(Args) -> apply(Fn,[Args]) orelse apply(disjoin(FnTail),[Args]) end; From happi@REDACTED Thu May 16 09:45:12 2002 From: happi@REDACTED (Happi) Date: Thu, 16 May 2002 09:45:12 +0200 Subject: Higher Order Function Question References: <3CE35BED.BA39BE26@cslab.ericsson.se> Message-ID: <012101c1fcad$9d543d90$c90b0a0a@LISA> Thomas Arts wrote: > ps. You don't need to use three apply's, I guess you want to > recursively apply disjoin on the rest of the functions: > > fun(Args) -> > apply(Fn, [Args]) orelse > apply(apply(disjoin, [FnTail]), [Args]) > end; > > is equal to: > > fun(Args) -> > apply(Fn,[Args]) orelse > apply(disjoin(FnTail),[Args]) > end; > wich is equal to: fun(Args) -> (Fn)(Args) orelse (disjoin(FnTail))(Args) end Perhaps you wanted: fun(Args) -> apply(Fn,Args) orelse apply(disjoin(FnTail),Args) end /Erik Praeterea censeo "0xCA" scribere Erlang posse. From vlad_dumitrescu@REDACTED Thu May 16 10:39:52 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 16 May 2002 10:39:52 +0200 Subject: Building R8B-1 on Windows Message-ID: Hello again, As a Windows user, I don't have to compile OTP, which is a blessing. But I thought I'd try last night, just to test some stuff. The result was not good, and I hope someone can provide some help... - I am using the latest Cygwin 1.3.10 on Windows XP Home - First I got the already noted problem with configure, hanging at "checking for unreliable floating point". - Removing that part gets us to the next step, make, that complains about an identifier while building the erts op table. Sorry, I thought I'd remember the exact error, but I don't. This is as far as I got before falling asleep. Is it a known problem? What should I do? A related question: is it true that dynamic drivers must be compiled with the same compiler as the Erts? thanks in advance. best regards, Vlad _________________________________________________________________ H?mta MSN Explorer kostnadsfritt p? http://explorer.msn.se/intl.asp From vlad_dumitrescu@REDACTED Thu May 16 13:58:20 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 16 May 2002 13:58:20 +0200 Subject: Building R8B-1 on QNX Message-ID: Hi, Well, if I remember right, I almost had it compiled... but then (unrelatedly! :-) my PC became unstable and I decided to install WinXP. That also meant that I had to reformat the HD, and I never bothered to reinstall QNX (mainly because it had problems with my graphics card, making it almost unusable) Sean Hinde did give it a shot too, and he provided a few useful tips - hopefully he got a little further :-) regards, Vlad _________________________________________________________________ Kom med i v?rldens st?rsta e-posttj?nst med MSN Hotmail. http://www.hotmail.com From apeake@REDACTED Fri May 17 01:37:18 2002 From: apeake@REDACTED (Alex Peake) Date: Thu, 16 May 2002 16:37:18 -0700 Subject: Higher Order Function Question In-Reply-To: <012101c1fcad$9d543d90$c90b0a0a@LISA> Message-ID: Thanks both of you for your help. I chose the: (Fn)(Args) rather than: apply(Fn,[Args]) It seems simpler, more elegant (am I missing something)? I saw no reference to this method (of apply) in the book. Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Happi > Sent: Thursday, May 16, 2002 12:45 AM > To: erlang-questions@REDACTED > Subject: Re: Higher Order Function Question > > > > Thomas Arts wrote: > > ps. You don't need to use three apply's, I guess you want to > > recursively apply disjoin on the rest of the functions: > > > > fun(Args) -> > > apply(Fn, [Args]) orelse > > apply(apply(disjoin, [FnTail]), [Args]) > > end; > > > > is equal to: > > > > fun(Args) -> > > apply(Fn,[Args]) orelse > > apply(disjoin(FnTail),[Args]) > > end; > > > > wich is equal to: > fun(Args) -> > (Fn)(Args) orelse (disjoin(FnTail))(Args) > end > > Perhaps you wanted: > fun(Args) -> > apply(Fn,Args) orelse > apply(disjoin(FnTail),Args) > end > > /Erik > Praeterea censeo "0xCA" scribere Erlang posse. > > > > From maurice@REDACTED Fri May 17 05:39:39 2002 From: maurice@REDACTED (Maurice Castro) Date: Fri, 17 May 2002 13:39:39 +1000 (EST) Subject: MPI Compatability Message-ID: <200205170339.g4H3ddE13297@parallel.serc.rmit.edu.au> Hi All, has anyone out there implemented an MPI compatible interface for Erlang. MPI is the Message Passing Interface thrashed out by the supercomputer community. (http://www-unix.mcs.anl.gov/mpi/) Thanks Maurice Castro From matthias@REDACTED Fri May 17 08:07:11 2002 From: matthias@REDACTED (matthias@REDACTED) Date: Fri, 17 May 2002 08:07:11 +0200 Subject: Higher Order Function Question In-Reply-To: References: <012101c1fcad$9d543d90$c90b0a0a@LISA> Message-ID: <15588.40463.955830.944997@beladrome.corelatus.se> Alex Peake writes: > I saw no reference to this method (of apply) in the book. The book is many years out of date, the language has changed in quite a few interesting ways since the book was written. It's well worth reading the "Erlang Extensions Since 4.4": http://www.erlang.org/doc/r8b/doc/extensions/part_frame.html Matthias From vlad_dumitrescu@REDACTED Fri May 17 09:54:00 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Fri, 17 May 2002 09:54:00 +0200 Subject: Building R8B-1 on Windows Message-ID: Hi again, I finally :-) noticed that the release note says that "there is no support for building the release from source on Windows". May I at least ask: No support as in "you're on your own", or as in "only we can do it"? And I would also like to know what compiler and version was used in the build. Thanks in advance. Regards, Vlad _________________________________________________________________ H?mta MSN Explorer kostnadsfritt p? http://explorer.msn.se/intl.asp From kenneth@REDACTED Fri May 17 11:14:46 2002 From: kenneth@REDACTED (Kenneth Lundin) Date: Fri, 17 May 2002 11:14:46 +0200 Subject: erl_interface References: , , <20020511174021.A344@mobility.motivity.ca> Message-ID: <3CE4CA06.B610CE43@erix.ericsson.se> Regarding Erl_interface (the application) it provides 2 interfaces erl_interface and ei (there is also 2 libraries with these names). One big difference between R7B and R8B is that "ei" is now documented and the interface that will be supported in the future. The erl_interface functions are retained for backwards compatibility and they are changed to use the ei functions for the implementation. During that change it is possible that some new errors have been introduced in the erl_interface part. If the erl_interface part of erl_interface does not works as good in R8B as it did in R7B we will of course correct it. But for new usage we recommend that you use the "ei" part only. /Kenneth (Product Manager of Erlang/OTP at Ericsson) Vance Shipley wrote: > > I can't help but interject at this point on the subject of message > types in erl_interface. It was asked what a zero length message would > be. The answer is that there are a number of message types and some > of those messages don't have any payload. An example is UNLINK. > > I have previously reported that you can't determine message type with > erl_interface in R8B. It's supposed to be in the ErlMessage structure > but it never gets set. > > The good news is that if you use the new ei library it does work and > I suppose that is all that is really necessary at this point. All new > work we are doing is based on ei and it works well. > > -Vance > > > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Vance Shipley > Sent: Tuesday, November 13, 2001 5:14 PM > To: Erlang Questions > Subject: ErlMessage emsg; emsg.type == 0 > > I'm having trouble with erl_interface on R8B. I'm porting some > code written with the erl_interface library, not ei standalone. > > The examples in the tutorial don't work either. > > cnode_s.c: > ErlMessage emsg; /* Incoming message */ > ... > got = erl_receive_msg(fd, buf, BUFSIZE, &emsg); > if (got == ERL_TICK) { > /* ignore */ > } else if (got == ERL_ERROR) { > loop = 0; > } else { > > if (emsg.type == ERL_REG_SEND) { > ... <----- *** NOT REACHED *** > } > } > > In all cases (emsg.type == 0). If you ignore this there is in fact > a valid message there, the rest of the structure has been filled in > approriately, as far as I can tell. > > typedef struct { > int type; > ETERM *msg; > ETERM *to; > ETERM *from; > char to_name[MAXREGLEN]; > } ErlMessage; > > > -Vance > > Vance Shipley > Motivity Telecom Inc. > +1 519 579 5816 -- Kenneth Lundin Ericsson Utvecklings AB kenneth@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 57 25 125 25 ?lvsj? From L.A.Timochouk@REDACTED Fri May 17 17:09:10 2002 From: L.A.Timochouk@REDACTED (Leonid Timochouk) Date: Fri, 17 May 2002 16:09:10 +0100 (BST) Subject: Threads support faulty in R8B-0 and R8B-1? Message-ID: Hello Erlang users, I am using Erlang/OTP R8B-0 (and now R8B-1) on Debian Linux with glibc 2.2.5, kernel 2.4.18. In both cases, "beam" blocks immediately on start-up if invoked with a non-0 number of threads via the "+A" option, does not even display the initial "Erlang (BEAM) emulator version ..." message. It does create 3 threads, though, and the first of them can be observed with a debugger. It has the following call stack (blocked at "sigsuspend"): #0 0x400daa0e in sigsuspend () from /lib/libc.so.6 #1 0x400a0629 in __pthread_wait_for_restart_signal () from /lib/libpthread.so.0 #2 0x4009fe2c in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0 #3 0x0809b33a in erts_thread_create (tpp=0x83b3498, func=0x809abac , arg=0x83b3490, detached=0) at sys/unix/sys_threads.c:226 #4 0x0809b029 in init_async (hndl=4) at beam/erl_async.c:90 #5 0x080b5f74 in async_drv_start (port_num=1, name=0x80e38bc "async", opts=0xbffff750) at sys/unix/sys.c:1798 #6 0x08070098 in open_driver (driver=0x8102540, pid=7, name=0x80e38bc "async", opts=0xbffff750) at beam/io.c:285 #7 0x080b6515 in sys_init_io (buf=0x8134700 "", size=65536) at sys/unix/sys.c:2175 #8 0x08070e0e in init_io () at beam/io.c:725 #9 0x0805b8c9 in erl_init () at beam/erl_init.c:200 #10 0x0805c171 in erl_start (argc=10, argv=0xbffffb04) at beam/erl_init.c:881 #11 0x0805b82b in main (argc=10, argv=0xbffffb04) at sys/unix/erl_main.c:27 #12 0x400ca65f in __libc_start_main () from /lib/libc.so.6 Anyone has an idea what's going on? Best regards, Leonid Timochouk Computing Laboratory University of Kent at Canterbury From spearce@REDACTED Fri May 17 21:55:50 2002 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 17 May 2002 15:55:50 -0400 Subject: Threads support faulty in R8B-0 and R8B-1? In-Reply-To: References: Message-ID: <20020517155550.C181932@spearce.org> I'm having this exact same issue on Debian with 2.4.18. I built beam with hipe, but have not tried it without hipe. I stuck it on the back burner, as I could always run the driver I'm developing in a pthread or an external process. I hadn't seen anything in the mailing list archives about this occuring before, but I didn't spend that long search either. Leonid Timochouk scrawled: > Hello Erlang users, > > I am using Erlang/OTP R8B-0 (and now R8B-1) on Debian Linux with glibc > 2.2.5, kernel 2.4.18. In both cases, "beam" blocks immediately on start-up > if invoked with a non-0 number of threads via the "+A" option, does not > even display the initial "Erlang (BEAM) emulator version ..." message. It > does create 3 threads, though, and the first of them can be observed with > a debugger. It has the following call stack (blocked at "sigsuspend"): > > #0 0x400daa0e in sigsuspend () from /lib/libc.so.6 > #1 0x400a0629 in __pthread_wait_for_restart_signal () > from /lib/libpthread.so.0 > #2 0x4009fe2c in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0 > #3 0x0809b33a in erts_thread_create (tpp=0x83b3498, > func=0x809abac , arg=0x83b3490, detached=0) > at sys/unix/sys_threads.c:226 > #4 0x0809b029 in init_async (hndl=4) at beam/erl_async.c:90 > #5 0x080b5f74 in async_drv_start (port_num=1, name=0x80e38bc "async", > opts=0xbffff750) at sys/unix/sys.c:1798 > #6 0x08070098 in open_driver (driver=0x8102540, pid=7, > name=0x80e38bc "async", opts=0xbffff750) at beam/io.c:285 > #7 0x080b6515 in sys_init_io (buf=0x8134700 "", size=65536) > at sys/unix/sys.c:2175 > #8 0x08070e0e in init_io () at beam/io.c:725 > #9 0x0805b8c9 in erl_init () at beam/erl_init.c:200 > #10 0x0805c171 in erl_start (argc=10, argv=0xbffffb04) at > beam/erl_init.c:881 > #11 0x0805b82b in main (argc=10, argv=0xbffffb04) at > sys/unix/erl_main.c:27 > #12 0x400ca65f in __libc_start_main () from /lib/libc.so.6 > > Anyone has an idea what's going on? > > Best regards, > > Leonid Timochouk > Computing Laboratory > University of Kent at Canterbury > -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From apeake@REDACTED Sat May 18 03:03:53 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 17 May 2002 18:03:53 -0700 Subject: Question on "The Erlang Way" Message-ID: I am new to Erlang. Can someone help me to "think the Erlang way" on the following (I am from the Lisp world): 1) I want to create a "global" to the application dict. Is this best done by spawning a process that manages the dict (like the number analyser sample in the Book)? It seems that because of the "assign once" strategy, regular variables do not work (dict:store returns a new Dict). 2) How do you build functions to have optional arguments, like "key" arguments in Lisp (there are too many permutations to use a pattern/guard for each)? (Lisp example: (create-attr "First_Name" varchar :dom-len 20 :nullable t) -- the first two arguments (name and domain) are required, but others dom-len, nullable and many others are optional (and have default values). From mikpe@REDACTED Sat May 18 15:48:39 2002 From: mikpe@REDACTED (Mikael Pettersson) Date: Sat, 18 May 2002 15:48:39 +0200 (MET DST) Subject: Threads support faulty in R8B-0 and R8B-1? Message-ID: <200205181348.PAA19508@harpo.it.uu.se> On Fri, 17 May 2002 15:55:50 -0400, Shawn Pearce wrote: >I'm having this exact same issue on Debian with 2.4.18. I built >beam with hipe, but have not tried it without hipe. I stuck it on the >back burner, as I could always run the driver I'm developing in a >pthread or an external process. > >I hadn't seen anything in the mailing list archives about this occuring >before, but I didn't spend that long search either. > >Leonid Timochouk scrawled: >> Hello Erlang users, >> >> I am using Erlang/OTP R8B-0 (and now R8B-1) on Debian Linux with glibc >> 2.2.5, kernel 2.4.18. In both cases, "beam" blocks immediately on start-up >> if invoked with a non-0 number of threads via the "+A" option, does not >> even display the initial "Erlang (BEAM) emulator version ..." message. It >> does create 3 threads, though, and the first of them can be observed with >> a debugger. It has the following call stack (blocked at "sigsuspend"): I can reproduce something similar with RedHat 7.3 / glibc-2.2.5. If I configure with --enable-threads --enable-hipe and start otp with +A and some number > 0, then it starts ok but hangs after halt(). This does not happen with RedHat 7.2 / glibc-2.2.4. I've confirmed that disabling HiPE/x86's signal() wrappers prevents the hang. Unfortunately, those wrappers are required, so for now you should treat hipe and threads as mutually exclusive on glibc-2.2.5 systems. I'll look into this problem next week. /Mikael Pettersson From cpressey@REDACTED Sat May 18 22:11:16 2002 From: cpressey@REDACTED (Chris Pressey) Date: Sat, 18 May 2002 15:11:16 -0500 Subject: Question on "The Erlang Way" In-Reply-To: References: Message-ID: <20020518151116.68f0c5cb.cpressey@catseye.mb.ca> On Fri, 17 May 2002 18:03:53 -0700 "Alex Peake" wrote: > I am new to Erlang. Can someone help me to "think the Erlang way" on the > following (I am from the Lisp world): > > 1) I want to create a "global" to the application dict. Is this best > done by spawning a process that manages the dict (like the number > analyser sample in the Book)? It seems that because of the "assign once" > strategy, regular variables do not work (dict:store returns a new Dict). Regular variables are also local to a single process. But process names aren't, so a named process (like the number analyser example) is probably the way to go. Actually, if I had my druthers, there'd be an application:set_env() function; then you wouldn't need to roll your own 'application dict'. > 2) How do you build functions to have optional arguments, like "key" > arguments in Lisp (there are too many permutations to use a > pattern/guard for each)? (Lisp example: (create-attr "First_Name" > varchar :dom-len 20:nullable t) -- the first two arguments (name and > domain) are required, but others dom-len, nullable and many others are > optional (and have default values). I would pass a list. Probably a list of {key, value} tuples, much like that used by the functions in GS. So your function call would look something like: create_attr("First_Name", varchar, [{dom_len, 20}, {nullable, t}]) (please excuse the fact that I don't know lisp :-) -Chris From hakan.stenholm@REDACTED Sun May 19 00:40:24 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 19 May 2002 00:40:24 +0200 Subject: Question on "The Erlang Way" Message-ID: <3E63E15B-6AB0-11D6-BC57-003065B5F8B4@mbox304.swipnet.se> >> I am new to Erlang. Can someone help me to "think the Erlang way" >> on the following (I am from the Lisp world): >> >> 1) I want to create a "global" to the application dict. Is this >> best >> done by spawning a process that manages the dict (like the number >> analyser sample in the Book)? It seems that because of the >> "assign once" >> strategy, regular variables do not work (dict:store returns a new >> Dict). >Regular variables are also local to a single process. But process >names aren't, so a named process (like the number analyser example) >is probably the way to go. You can either use "gen_server" to create a custom server process or if you only need a key-value database you could also use "ets", ets tables can be created as either local or global - global ones can be accessed by any other process. There is also the "put" and "get" operations (see the erlang module) to use the process dictionary, this allows global variables in the scoop of a single process. Process dictionaries should for obvious reasons (obfuscating code execution flow) only be used sparingly. Mnesia can be used as a alternative to ets if proper database transaction support is needed. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1262 bytes Desc: not available URL: From apeake@REDACTED Sun May 19 23:19:09 2002 From: apeake@REDACTED (Alex Peake) Date: Sun, 19 May 2002 14:19:09 -0700 Subject: Question on "The Erlang Way" In-Reply-To: <3E63E15B-6AB0-11D6-BC57-003065B5F8B4@mbox304.swipnet.se> Message-ID: Thank you for your suggestion. I think I will use "ets" as my first attempt. Alex -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Hakan Stenholm Sent: Saturday, May 18, 2002 3:40 PM To: erlang-questions@REDACTED Subject: Re: Question on "The Erlang Way" >> I am new to Erlang. Can someone help me to "think the Erlang way" >> on the following (I am from the Lisp world): >> >> 1) I want to create a "global" to the application dict. Is this >> best >> done by spawning a process that manages the dict (like the number >> analyser sample in the Book)? It seems that because of the >> "assign once" >> strategy, regular variables do not work (dict:store returns a new >> Dict). >Regular variables are also local to a single process. But process >names aren't, so a named process (like the number analyser example) >is probably the way to go. You can either use "gen_server" to create a custom server process or if you only need a key-value database you could also use "ets", ets tables can be created as either local or global - global ones can be accessed by any other process. There is also the "put" and "get" operations (see the erlang module) to use the process dictionary, this allows global variables in the scoop of a single process. Process dictionaries should for obvious reasons (obfuscating code execution flow) only be used sparingly. Mnesia can be used as a alternative to ets if proper database transaction support is needed. From apeake@REDACTED Mon May 20 04:57:52 2002 From: apeake@REDACTED (Alex Peake) Date: Sun, 19 May 2002 19:57:52 -0700 Subject: XEmacs on Windows Message-ID: Can anyone one give me a quick start on setting up XEmacs on Windows (2000) to manage Erlang development? Thanks, Alex From apeake@REDACTED Tue May 21 07:03:37 2002 From: apeake@REDACTED (Alex Peake) Date: Mon, 20 May 2002 22:03:37 -0700 Subject: Records, encapsulation and optional elements Message-ID: I am new to Erlang. Could someone please advise if the following is a reasonable attempt at encapsulating the creation of records (with optional elements)? Is there a more elegant way? It seems a shame that I can define defaults (in the .hrl) and yet not use them (in an encapsulated way) in the .erl. Thanks, Alex %% File: attr.hrl %%----------------------------------------------------------- %% Data Type: attr %% where: %% name: A string (default is undefined). %% domain: An atom (default is undefined). %% domLen: An integer (default is undefined). %% domPrec: An integer (default is undefined). %% nullable: A boolean (default is false). %% isPk: A boolean (default is false). %% pkPos: An integer (default is undefined). %% fkPos: An integer (default is undefined). %% fkRel: A string (default is undefined). %% fkAttr: A string (default is undefined). %% autonum: A boolean (default is false). %%------------------------------------------------------------ -record(attr, {name, domain, domLen = 0, domPrec = 0, nullable = false, isPk = false, pkPos, fkPos, fkRel, fkAttr, autonum = false}). -module(attr). -include("attr.hrl"). -export([make_attr/3, varName/1, label/1]). -export([findNamed/2, findNamedC/1, findFromNameList/2]). %%----------------------------------------------------------- %% Data Type: attr %% where: %% name: A string (default is undefined). %% domain: An atom (default is undefined). %% domLen: An integer (default is undefined). %% domPrec: An integer (default is undefined). %% nullable: A boolean (default is false). %% isPk: A boolean (default is false). %% pkPos: An integer (default is undefined). %% fkPos: An integer (default is undefined). %% fkRel: A string (default is undefined). %% fkAttr: A string (default is undefined). %% autonum: A boolean (default is false). %%------------------------------------------------------------ %% Name and Domain are required arguments. %% Options is a list of Tuples for the rest. %% Example: [{nullable, true},{isPK, true},{pkPos,1}] make_attr(Name, Domain, Options) -> DomLen = case lists:keysearch(domLen, 1, Options) of {value,{domLen, Value}} -> Value; _ -> undefined end, DomPrec = case lists:keysearch(domPrec, 1, Options) of {value,{domPrec, Value}} -> Value; _ -> undefined end, Nullable = case lists:keysearch(nullable, 1, Options) of {value,{nullable, Value}} -> Value; _ -> false end, IsPk = case lists:keysearch(isPk, 1, Options) of {value,{isPk, Value}} -> Value; _ -> false end, PkPos = case lists:keysearch(pkPos, 1, Options) of {value,{pkPos, Value}} -> Value; _ -> undefined end, FkPos = case lists:keysearch(fkPos, 1, Options) of {value,{fkPos, Value}} -> Value; _ -> undefined end, FkRel = case lists:keysearch(fkRel, 1, Options) of {value,{fkRel, Value}} -> Value; _ -> undefined end, FkAttr = case lists:keysearch(fkAttr, 1, Options) of {value,{fkAttr, Value}} -> Value; _ -> undefined end, Autonum = case lists:keysearch(autonum, 1, Options) of {value,{autonum, Value}} -> Value; _ -> false end, #attr{name = Name, domain = Domain, domLen = DomLen, domPrec = DomPrec, nullable = Nullable, isPk = IsPk, pkPos = PkPos, fkPos = FkPos, fkRel = FkRel, fkAttr = FkAttr, autonum = Autonum}. From ingela@REDACTED Tue May 21 08:55:22 2002 From: ingela@REDACTED (Ingela Anderton) Date: Tue, 21 May 2002 08:55:22 +0200 (MEST) Subject: Records, encapsulation and optional elements References: Message-ID: <15593.60768.110319.32015@gildor> I would suggest something like this: make_attr(Name, Domain, [Option | Options]) -> make_attr(#attr{name = Name, domain = Domain}, Options). make_attr(Record, {nullable, Value}, []) -> Record#attr{nullable = Value}; make_attr(Record, {nullable, Value}, [Option | Options]) -> make_attr(Record#attr{nullable = Value}, Option, Options); make_attr(Record, {domLen, Value}, []) -> Record#attr{domLen = Value}; make_attr(Record, {domLen, Value}, [Option | Options]) -> make_attr(Record#attr{domLen = Value}, Option, Options); .... for more information on how records work see: http://www.erlang.se/doc/doc-5.1/doc/extensions/part_frame.html Alex Peake wrote: > I am new to Erlang. Could someone please advise if the following is a > reasonable attempt at encapsulating the creation of records (with optional > elements)? Is there a more elegant way? It seems a shame that I can define > defaults (in the .hrl) and yet not use them (in an encapsulated way) in the > .erl. > > Thanks, > > Alex > > > %% File: attr.hrl > > %%----------------------------------------------------------- > %% Data Type: attr > %% where: > %% name: A string (default is undefined). > %% domain: An atom (default is undefined). > %% domLen: An integer (default is undefined). > %% domPrec: An integer (default is undefined). > %% nullable: A boolean (default is false). > %% isPk: A boolean (default is false). > %% pkPos: An integer (default is undefined). > %% fkPos: An integer (default is undefined). > %% fkRel: A string (default is undefined). > %% fkAttr: A string (default is undefined). > %% autonum: A boolean (default is false). > %%------------------------------------------------------------ > > -record(attr, {name, domain, domLen = 0, domPrec = 0, nullable = false, isPk > = false, pkPos, fkPos, fkRel, fkAttr, autonum = false}). > > > > > > > -module(attr). > -include("attr.hrl"). > -export([make_attr/3, varName/1, label/1]). > -export([findNamed/2, findNamedC/1, findFromNameList/2]). > > %%----------------------------------------------------------- > %% Data Type: attr > %% where: > %% name: A string (default is undefined). > %% domain: An atom (default is undefined). > %% domLen: An integer (default is undefined). > %% domPrec: An integer (default is undefined). > %% nullable: A boolean (default is false). > %% isPk: A boolean (default is false). > %% pkPos: An integer (default is undefined). > %% fkPos: An integer (default is undefined). > %% fkRel: A string (default is undefined). > %% fkAttr: A string (default is undefined). > %% autonum: A boolean (default is false). > %%------------------------------------------------------------ > > > %% Name and Domain are required arguments. > %% Options is a list of Tuples for the rest. > %% Example: [{nullable, true},{isPK, true},{pkPos,1}] > make_attr(Name, Domain, Options) -> > DomLen = case lists:keysearch(domLen, 1, Options) of > {value,{domLen, Value}} -> > Value; > _ -> > undefined > end, > DomPrec = case lists:keysearch(domPrec, 1, Options) of > {value,{domPrec, Value}} -> > Value; > _ -> > undefined > end, > Nullable = case lists:keysearch(nullable, 1, Options) of > {value,{nullable, Value}} -> > Value; > _ -> > false > end, > IsPk = case lists:keysearch(isPk, 1, Options) of > {value,{isPk, Value}} -> > Value; > _ -> > false > end, > PkPos = case lists:keysearch(pkPos, 1, Options) of > {value,{pkPos, Value}} -> > Value; > _ -> > undefined > end, > FkPos = case lists:keysearch(fkPos, 1, Options) of > {value,{fkPos, Value}} -> > Value; > _ -> > undefined > end, > FkRel = case lists:keysearch(fkRel, 1, Options) of > {value,{fkRel, Value}} -> > Value; > _ -> > undefined > end, > FkAttr = case lists:keysearch(fkAttr, 1, Options) of > {value,{fkAttr, Value}} -> > Value; > _ -> > undefined > end, > Autonum = case lists:keysearch(autonum, 1, Options) of > {value,{autonum, Value}} -> > Value; > _ -> > false > end, > #attr{name = Name, domain = Domain, domLen = DomLen, domPrec = DomPrec, > nullable = Nullable, isPk = IsPk, pkPos = PkPos, fkPos = FkPos, > fkRel = FkRel, fkAttr = FkAttr, autonum = Autonum}. > -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team Cellular/Mobile: +46 70 636 78 68 From vlad_dumitrescu@REDACTED Tue May 21 08:56:53 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Tue, 21 May 2002 08:56:53 +0200 Subject: Communicating with Java node Message-ID: Hi all, I have a problem that I can't find the cause, and hope someone might know the answer. I have an Erlang and a Java node communicating with each other. I noticed that if an Erlang process sends many messages to a Java process, then it is sometimes being slowed down, as if it was waiting for some response (which is not the case). The delay occurs when the Java process, upon receiving the message, writes something to the console... The difference for 1000 messages is ~500 ms when Java only reads the msg, and ~2200 ms when the receive is followed by an System.out.println. The delay seems to be independent of how much text is written. Is it something that I do wrong, or is it normal behaviour, or is there a bug? Thanks in advance, Vlad Erlang code: -module(tt). -compile(export_all). go(0)-> ok; go(N) -> {main, java@REDACTED} ! {self(), hello}, go(N-1). shell> timer:tc(tt, go, [999]). Java code: import com.ericsson.otp.erlang.*; class App { public static main(String[] args) { try { OtpErlangNode node = new OtpErlangNode("java"); OtpErlangMbox mbox = node.createMbox("main"); while(true) { OtpErlangObject msg = mbox.receive(); // System.out.println("got: "+msg.toString()); } } catch (Exception ex) {} } } _________________________________________________________________ Chatta med kompisar online, prova MSN Messenger: http://messenger.msn.com From svg@REDACTED Tue May 21 11:23:32 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 21 May 2002 15:23:32 +0600 (YEKST) Subject: Records, encapsulation and optional elements In-Reply-To: References: Message-ID: <20020521.152332.27597189.svg@surnet.ru> Good day, Your code could be more compact: make_attr(Name, Domain, Options) -> Rec = #attr{name = Name, domain = Domain}, Ret = lists:foldl(fun({domLen, Val}, AccRec) -> AccRec#attr{domLen = Val}; ({domPrec, Val}, AccRec) -> AccRec#attr{domPrec = Val}; ... ({autonum, Val}, AccRec) -> AccRec#attr{autonum = Val} end, Rec, Options), Ret. or without generic functions: make_attr(Name, Domain, Options) -> Rec = #attr{name = Name, domain = Domain}, make_attr(Rec, Options). make_attr(Rec, []) -> Rec; make_attr(Rec, [{domLen, Val}| Rest]) -> make_attr(Rec#attr{domLen = Val}, Rest); ... make_attr(Rec, [{autonum, Val}| Rest]) -> make_attr(Rec#attr{autonum = Val}, Rest). Best Regards, Vladimir Sekissov apeake> I am new to Erlang. Could someone please advise if the following is a apeake> reasonable attempt at encapsulating the creation of records (with optional apeake> elements)? Is there a more elegant way? It seems a shame that I can define apeake> defaults (in the .hrl) and yet not use them (in an encapsulated way) in the apeake> ..erl. apeake> apeake> Thanks, apeake> apeake> Alex apeake> apeake> apeake> %% File: attr.hrl apeake> apeake> %%----------------------------------------------------------- apeake> %% Data Type: attr apeake> %% where: apeake> %% name: A string (default is undefined). apeake> %% domain: An atom (default is undefined). apeake> %% domLen: An integer (default is undefined). apeake> %% domPrec: An integer (default is undefined). apeake> %% nullable: A boolean (default is false). apeake> %% isPk: A boolean (default is false). apeake> %% pkPos: An integer (default is undefined). apeake> %% fkPos: An integer (default is undefined). apeake> %% fkRel: A string (default is undefined). apeake> %% fkAttr: A string (default is undefined). apeake> %% autonum: A boolean (default is false). apeake> %%------------------------------------------------------------ apeake> apeake> -record(attr, {name, domain, domLen = 0, domPrec = 0, nullable = false, isPk apeake> = false, pkPos, fkPos, fkRel, fkAttr, autonum = false}). apeake> apeake> apeake> apeake> apeake> apeake> apeake> -module(attr). apeake> -include("attr.hrl"). apeake> -export([make_attr/3, varName/1, label/1]). apeake> -export([findNamed/2, findNamedC/1, findFromNameList/2]). apeake> apeake> %%----------------------------------------------------------- apeake> %% Data Type: attr apeake> %% where: apeake> %% name: A string (default is undefined). apeake> %% domain: An atom (default is undefined). apeake> %% domLen: An integer (default is undefined). apeake> %% domPrec: An integer (default is undefined). apeake> %% nullable: A boolean (default is false). apeake> %% isPk: A boolean (default is false). apeake> %% pkPos: An integer (default is undefined). apeake> %% fkPos: An integer (default is undefined). apeake> %% fkRel: A string (default is undefined). apeake> %% fkAttr: A string (default is undefined). apeake> %% autonum: A boolean (default is false). apeake> %%------------------------------------------------------------ apeake> apeake> apeake> %% Name and Domain are required arguments. apeake> %% Options is a list of Tuples for the rest. apeake> %% Example: [{nullable, true},{isPK, true},{pkPos,1}] apeake> make_attr(Name, Domain, Options) -> apeake> DomLen = case lists:keysearch(domLen, 1, Options) of apeake> {value,{domLen, Value}} -> apeake> Value; apeake> _ -> apeake> undefined apeake> end, apeake> DomPrec = case lists:keysearch(domPrec, 1, Options) of apeake> {value,{domPrec, Value}} -> apeake> Value; apeake> _ -> apeake> undefined apeake> end, apeake> Nullable = case lists:keysearch(nullable, 1, Options) of apeake> {value,{nullable, Value}} -> apeake> Value; apeake> _ -> apeake> false apeake> end, apeake> IsPk = case lists:keysearch(isPk, 1, Options) of apeake> {value,{isPk, Value}} -> apeake> Value; apeake> _ -> apeake> false apeake> end, apeake> PkPos = case lists:keysearch(pkPos, 1, Options) of apeake> {value,{pkPos, Value}} -> apeake> Value; apeake> _ -> apeake> undefined apeake> end, apeake> FkPos = case lists:keysearch(fkPos, 1, Options) of apeake> {value,{fkPos, Value}} -> apeake> Value; apeake> _ -> apeake> undefined apeake> end, apeake> FkRel = case lists:keysearch(fkRel, 1, Options) of apeake> {value,{fkRel, Value}} -> apeake> Value; apeake> _ -> apeake> undefined apeake> end, apeake> FkAttr = case lists:keysearch(fkAttr, 1, Options) of apeake> {value,{fkAttr, Value}} -> apeake> Value; apeake> _ -> apeake> undefined apeake> end, apeake> Autonum = case lists:keysearch(autonum, 1, Options) of apeake> {value,{autonum, Value}} -> apeake> Value; apeake> _ -> apeake> false apeake> end, apeake> #attr{name = Name, domain = Domain, domLen = DomLen, domPrec = DomPrec, apeake> nullable = Nullable, isPk = IsPk, pkPos = PkPos, fkPos = FkPos, apeake> fkRel = FkRel, fkAttr = FkAttr, autonum = Autonum}. apeake> apeake> From eleberg@REDACTED Tue May 21 12:26:33 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Tue, 21 May 2002 12:26:33 +0200 (MET DST) Subject: Erlounge Stockholm Message-ID: <200205211026.g4LAQXU21984@cbe.ericsson.se> greetings, first let me express a big thank you to mr per of synapse for the very nice evening. when erlounge takes place again, in the near future?, i will make my outmost to be present again. upon my early arrival at mackinlays inn i realised that without a flag, or similar, it would be impossible for me to recognise any erlang programmers present at macinlays. i do not know anybody. should have thought of that slightly earlier. as luck would have it there was a human flagpole present that i had seen on the erlang user conference last year (my first). mr lon is canadian, 2 meters tall and clad in uniformly black clothes. his hair is also black and rather long. the black cowboy hat, worn even indoors, is not really neccessary to make recognition immediate. having located the erlang people my luck ran out. the nice tasting draught cider i had drunk at a previous visit had been replaced with some terrible sugery swedish imitation. the bottled alternative was still english, but this evening it was unfortunatly all sold out. this made me slightly depressed. after sounding out the people present about their respective companies potential for hireing, i got really depressed. it seemed as if everybody was working in very hard pressed parts of the software industry (telecom, to a man). my chances of continuing with erlang once i get kicked out from axd301 (any day now since i was the last person permitted onboard ericsson about a year ago) looks like zero. not good. the beer testing was intellectually stimulating. a nice representative from nils oscar micro brewery talked a lot about beer in sweden and all over the world. how to manufacture it, how to drink it. after having tasted more diverse beers than ever before in my life i can now say, with much greater authority than before, that all beer tastes awfull. give me a 'real' (non swedish) cider any day. there is something i would like to pick your collective brains about. tasting, eg beer, has its four basic flavours. sweet, sour, bitter and ? what is the fourth taste called? presumably this is 'besk' in swedish, or i might have gotten even this simple fact muddled up. there was a suggestion that salt is a basic taste, but then which of the others is phoney? since mr mathias mentioned that he met me i will take the opportunity to write a little about him. at the user conference alluded to beforehand mr mathias made the absolutly best presentation. the subject matter was not one that interests me very much. it seems it had a lot to do with hardware which is not my cup of tea. but the way it was presented was hilarious, in the very dry and understated way i like humor to be. moreover, after an earlier incredibly spannishified english presentation the very precise and brittish accent was pure pleasure. i picked up what little curage i had left (remember that i was already depressed and by then i had additionally heard rumors about axd301 getting cancelled in its entirity to make it possible for ericsson to stop supporting erlang) and approched mr mathias. i told him my sentiments about his presentation and he answered (in one breath) 'thank you and what do you want?' my confusion was so apperant that he kindly explained that such blatant flattery was most often followed by the most unsubtle asking for favours. mr mathias was even more entertaning in private than at conferences and the rest of the evening turned out to be really funny. guess what? the owner of the best british accent at the user conference is from australia. bengt From enano@REDACTED Tue May 21 13:06:21 2002 From: enano@REDACTED (Miguel Barreiro Paz) Date: Tue, 21 May 2002 13:06:21 +0200 (CEST) Subject: Erlounge Stockholm In-Reply-To: <200205211026.g4LAQXU21984@cbe.ericsson.se> Message-ID: > pleasure. i picked up what little curage i had left (remember that i > was already depressed and by then i had additionally heard rumors about > axd301 getting cancelled in its entirity to make it possible for > ericsson to stop supporting erlang) and approched mr mathias. i told I'm sure those who really know about that can't speak publicly, but god, what is the feeling around there on that particular? Kind, although 'incredibly spannishified', regards ;) Miguel From etxuwig@REDACTED Tue May 21 13:06:40 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 21 May 2002 13:06:40 +0200 (MET DST) Subject: Erlounge Stockholm In-Reply-To: <200205211026.g4LAQXU21984@cbe.ericsson.se> Message-ID: On Tue, 21 May 2002, Bengt Kleberg wrote: >(remember that i was already depressed and by then i had >additionally heard rumors about axd301 getting cancelled in its >entirity to make it possible for ericsson to stop supporting >erlang) Well, not all rumours are true. (: /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From eleberg@REDACTED Tue May 21 13:21:42 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Tue, 21 May 2002 13:21:42 +0200 (MET DST) Subject: Erlounge Stockholm Message-ID: <200205211121.g4LBLgU25791@cbe.ericsson.se> > Date: Tue, 21 May 2002 13:06:21 +0200 (CEST) > From: Miguel Barreiro Paz > I'm sure those who really know about that can't speak publicly, > but god, what is the feeling around there on that particular? just a _rumor_. > Kind, although 'incredibly spannishified', regards ;) i should perhaps have added :-) before and after the text. you obviously understood, but there might be someone that did not. bengt From willem@REDACTED Tue May 21 14:44:06 2002 From: willem@REDACTED (Willem Broekema) Date: Tue, 21 May 2002 14:44:06 +0200 Subject: Records, encapsulation and optional elements References: Message-ID: <3CEA4116.2050900@pastelhorn.com> Alex Peake wrote: > I am new to Erlang. Could someone please advise if the following is a > reasonable attempt at encapsulating the creation of records (with optional > elements)? Is there a more elegant way? It seems a shame that I can define > defaults (in the .hrl) and yet not use them (in an encapsulated way) in the > .erl. Until it's possible to use a variable in record_info/2 (so it's evaluated at run-time instead of compile-time), I use the following to avoid repeating code when assigning multiple attributes: -record(r, {k1,k2,k3}). test() -> F = record_info(fields, r), % Create an 'r' record: R = iter_fields(r, [{k1,v1},{k2,v2}], F), io:format("R: ~p~n", [R]), % Update the record, by supplying a {key,val} list: R2 = iter_fields(R, [{k2,newv2}, {k3,newv3}], F), io:format("R2: ~p~n", [R2]). where 'iter_fields' is defined as follows: % We make use of knowledge about implementation of records. % It's bad style, but so very useful! ;-) % % Translate a {k,v} list 'L' to a record 'somerecord': % L = [ {k1,v1}, ... ] % Fields = record_info(fields, somerecord), % R = iter_fields(somerecord, L, Fields). iter_fields(L, [] ) when list(L) -> []; iter_fields( L, [F|Fields] ) when list(L) -> case lists:keysearch(F, 1, L) of {value, {F, Val}} -> [Val | iter_fields(L, Fields) ]; false -> [undefined | iter_fields(L, Fields) ] end. % Updating an existing record: % R = #somerecord{ k1=v1, k2=v2 }, % Fields = record_info(fields, somerecord), % R2 = iter_fields(R, [{k2,v2new}], Fields) iter_fields(RName, KVL, L) when atom(RName), list(KVL), list(L) -> % Assume 'RName' is record name, L its fieldlist list_to_tuple( [RName | iter_fields(KVL, L)] ); iter_fields(Old, KVL, L) when tuple(Old) -> % Assume 'Old' is a existing record, L its fieldlist. OldL = tuple_to_list(Old), list_to_tuple( [ hd(OldL) | iter_fields( tl(OldL), KVL, L) ] ); iter_fields(OldL, KVL, []) when list(OldL) -> []; iter_fields( [O|OldL], KVL, [F|Fields] ) -> case lists:keysearch(F, 1, KVL) of {value, {F, Val}} -> % Field is overridden by KVL. [Val | iter_fields(OldL, KVL, Fields) ]; false -> % Field value is not overridden, so use old val. [O | iter_fields(OldL, KVL, Fields) ] end. - Willem From apeake@REDACTED Tue May 21 16:57:29 2002 From: apeake@REDACTED (Alex Peake) Date: Tue, 21 May 2002 07:57:29 -0700 Subject: Records, encapsulation and optional elements In-Reply-To: <20020521.152332.27597189.svg@surnet.ru> Message-ID: Thank you so much. Much more elegant! (I also got useful suggestions from Ingela Anderton - similar to your second solution - and Willem Broekema). It seems, then, that there is a trade-off between the compact, elegant code solutions that you suggest and my clumsy attempt: * Your solutions involve copying the record several times before completion * My solution looks ugly (and creates lots of intermediate variables) Is that a reasonable assessment? Alex BTW, I assume the copying cost is not significant? > -----Original Message----- > From: Vladimir Sekissov [mailto:svg@REDACTED] > Sent: Tuesday, May 21, 2002 2:24 AM > To: apeake@REDACTED > Cc: erlang-questions@REDACTED > Subject: Re: Records, encapsulation and optional elements > > > Good day, > > Your code could be more compact: > > make_attr(Name, Domain, Options) -> > Rec = #attr{name = Name, domain = Domain}, > Ret = lists:foldl(fun({domLen, Val}, AccRec) -> > AccRec#attr{domLen = Val}; > ({domPrec, Val}, AccRec) -> > AccRec#attr{domPrec = Val}; > ... > ({autonum, Val}, AccRec) -> > AccRec#attr{autonum = Val} > end, Rec, Options), > Ret. > > or without generic functions: > > make_attr(Name, Domain, Options) -> > Rec = #attr{name = Name, domain = Domain}, > make_attr(Rec, Options). > > make_attr(Rec, []) -> > Rec; > make_attr(Rec, [{domLen, Val}| Rest]) -> > make_attr(Rec#attr{domLen = Val}, Rest); > ... > make_attr(Rec, [{autonum, Val}| Rest]) -> > make_attr(Rec#attr{autonum = Val}, Rest). > > Best Regards, > > Vladimir Sekissov > > apeake> I am new to Erlang. Could someone please advise if the > following is a > apeake> reasonable attempt at encapsulating the creation of > records (with optional > apeake> elements)? Is there a more elegant way? It seems a shame > that I can define > apeake> defaults (in the .hrl) and yet not use them (in an > encapsulated way) in the > apeake> ..erl. > apeake> > apeake> Thanks, > apeake> > apeake> Alex > apeake> > apeake> > apeake> %% File: attr.hrl > apeake> > apeake> %%----------------------------------------------------------- > apeake> %% Data Type: attr > apeake> %% where: > apeake> %% name: A string (default is undefined). > apeake> %% domain: An atom (default is undefined). > apeake> %% domLen: An integer (default is undefined). > apeake> %% domPrec: An integer (default is undefined). > apeake> %% nullable: A boolean (default is false). > apeake> %% isPk: A boolean (default is false). > apeake> %% pkPos: An integer (default is undefined). > apeake> %% fkPos: An integer (default is undefined). > apeake> %% fkRel: A string (default is undefined). > apeake> %% fkAttr: A string (default is undefined). > apeake> %% autonum: A boolean (default is false). > apeake> %%------------------------------------------------------------ > apeake> > apeake> -record(attr, {name, domain, domLen = 0, domPrec = 0, > nullable = false, isPk > apeake> = false, pkPos, fkPos, fkRel, fkAttr, autonum = false}). > apeake> > apeake> > apeake> > apeake> > apeake> > apeake> > apeake> -module(attr). > apeake> -include("attr.hrl"). > apeake> -export([make_attr/3, varName/1, label/1]). > apeake> -export([findNamed/2, findNamedC/1, findFromNameList/2]). > apeake> > apeake> %%----------------------------------------------------------- > apeake> %% Data Type: attr > apeake> %% where: > apeake> %% name: A string (default is undefined). > apeake> %% domain: An atom (default is undefined). > apeake> %% domLen: An integer (default is undefined). > apeake> %% domPrec: An integer (default is undefined). > apeake> %% nullable: A boolean (default is false). > apeake> %% isPk: A boolean (default is false). > apeake> %% pkPos: An integer (default is undefined). > apeake> %% fkPos: An integer (default is undefined). > apeake> %% fkRel: A string (default is undefined). > apeake> %% fkAttr: A string (default is undefined). > apeake> %% autonum: A boolean (default is false). > apeake> %%------------------------------------------------------------ > apeake> > apeake> > apeake> %% Name and Domain are required arguments. > apeake> %% Options is a list of Tuples for the rest. > apeake> %% Example: [{nullable, true},{isPK, true},{pkPos,1}] > apeake> make_attr(Name, Domain, Options) -> > apeake> DomLen = case lists:keysearch(domLen, 1, Options) of > apeake> {value,{domLen, Value}} -> > apeake> Value; > apeake> _ -> > apeake> undefined > apeake> end, > apeake> DomPrec = case lists:keysearch(domPrec, 1, Options) of > apeake> {value,{domPrec, Value}} -> > apeake> Value; > apeake> _ -> > apeake> undefined > apeake> end, > apeake> Nullable = case lists:keysearch(nullable, 1, Options) of > apeake> {value,{nullable, Value}} -> > apeake> Value; > apeake> _ -> > apeake> false > apeake> end, > apeake> IsPk = case lists:keysearch(isPk, 1, Options) of > apeake> {value,{isPk, Value}} -> > apeake> Value; > apeake> _ -> > apeake> false > apeake> end, > apeake> PkPos = case lists:keysearch(pkPos, 1, Options) of > apeake> {value,{pkPos, Value}} -> > apeake> Value; > apeake> _ -> > apeake> undefined > apeake> end, > apeake> FkPos = case lists:keysearch(fkPos, 1, Options) of > apeake> {value,{fkPos, Value}} -> > apeake> Value; > apeake> _ -> > apeake> undefined > apeake> end, > apeake> FkRel = case lists:keysearch(fkRel, 1, Options) of > apeake> {value,{fkRel, Value}} -> > apeake> Value; > apeake> _ -> > apeake> undefined > apeake> end, > apeake> FkAttr = case lists:keysearch(fkAttr, 1, Options) of > apeake> {value,{fkAttr, Value}} -> > apeake> Value; > apeake> _ -> > apeake> undefined > apeake> end, > apeake> Autonum = case lists:keysearch(autonum, 1, Options) of > apeake> {value,{autonum, Value}} -> > apeake> Value; > apeake> _ -> > apeake> false > apeake> end, > apeake> #attr{name = Name, domain = Domain, domLen = DomLen, > domPrec = DomPrec, > apeake> nullable = Nullable, isPk = IsPk, pkPos = PkPos, > fkPos = FkPos, > apeake> fkRel = FkRel, fkAttr = FkAttr, autonum = Autonum}. > apeake> > apeake> > From svg@REDACTED Tue May 21 17:12:14 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 21 May 2002 21:12:14 +0600 (YEKST) Subject: Records, encapsulation and optional elements In-Reply-To: References: <20020521.152332.27597189.svg@surnet.ru> Message-ID: <20020521.211214.15837800.svg@surnet.ru> Good day, apeake> It seems, then, that there is a trade-off between the compact, apeake> elegant code apeake> solutions that you suggest and my clumsy attempt: apeake> * Your solutions involve copying the record several times apeake> before completion apeake> * My solution looks ugly (and creates lots of intermediate variables) Don't bother. It is always the same record. All objects are called by reference. Erlang emulator "knows" when it must create a copy of your object( for example when you send it as message). Best Regards, Vladimir Sekissov From etxuwig@REDACTED Tue May 21 17:30:27 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 21 May 2002 17:30:27 +0200 (MET DST) Subject: Records, encapsulation and optional elements In-Reply-To: Message-ID: On Tue, 21 May 2002, Alex Peake wrote: >It seems, then, that there is a trade-off between the compact, >elegant code solutions that you suggest and my clumsy attempt: > >* Your solutions involve copying the record several times before > completion True, but for small records, this is hardly detectable. The VM will have a hard time optimizing away the copying, since we're setting one value at a time. For a huge record (=very large number of attributes), this might be a problem, but normally it's insignificant. >* My solution looks ugly (and creates lots of intermediate > variables) I don't think the number of intermediate variables is a problem, but your code makes lots of passes with lists:keysearch/2 through the Options list. This will most likely be more expensive than the record copying above. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From gerd@REDACTED Wed May 22 12:43:58 2002 From: gerd@REDACTED (Gerd Flaig) Date: Wed, 22 May 2002 12:43:58 +0200 Subject: Higher Order Function Question In-Reply-To: ("Alex Peake"'s message of "Thu, 16 May 2002 16:37:18 -0700") References: Message-ID: "Alex Peake" writes: > (Fn)(Args) why not just "Fn(Args)"? Goodbyte, Gerd. -- Gerd Flaig Technik gerd@REDACTED Bei Schlund + Partner AG Erbprinzenstr. 4-12 D-76133 Karlsruhe Physics is like sex: sure, it may give some practical results, but that's not why we do it. -- Richard Feynman From ingela@REDACTED Wed May 22 13:14:48 2002 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 22 May 2002 13:14:48 +0200 (MEST) Subject: Records, encapsulation and optional elements References: <20020521.152332.27597189.svg@surnet.ru> Message-ID: <15595.28217.165950.174218@gildor> Alex Peake wrote: > Thank you so much. Much more elegant! > > (I also got useful suggestions from Ingela Anderton - similar to your second > solution - and Willem Broekema). Well my solution was of the top of my head. The first thing that usually comes to mind when programing a functional language as Erlang is recursion. Although some times it can be beneficial to use higher order functions from the lists library and not do all the recursion explicit. The list functions are very powerful but might in some cases make the code harder to understand. I guess it is a bit a matter of taste and I always decide from case to case which I prefer. I said in may mail that I would suggest something like that because I wanted to show the principal but I really had not put a lot of effort into the example. I changed your program as little as possible, any I even managed to put a bug into it. (I guess it always ends up being more work when you are lazy ;)) Well which ever way you decide Willems code was a cleaner example. > It seems, then, that there is a trade-off between the compact, elegant code > solutions that you suggest and my clumsy attempt: > > * Your solutions involve copying the record several times before completion > > * My solution looks ugly (and creates lots of intermediate variables) > > Is that a reasonable assessment? > Alex > > BTW, I assume the copying cost is not significant? Well Ulf Wiger already answered most of this. I just wanted to add that your first attempt reminded me more of a C program than an Erlang program. When programing Erlang you should think pattern matching and recursion. Also you should first make things work and then make them faster if necessary. Especially if you want to use dirty tricks. Most of the time however dirty tricks are unnecessary and it will be sufficient to use the data structures and mechanisms in a wise way. If you are intrested in avoiding common misuses that make things more inefficient you should take a look at: http://www.erlang.se/doc/doc-5.1/doc/efficiency_guide/part_frame.html -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team Cellular/Mobile: +46 70 636 78 68 From joe@REDACTED Wed May 22 15:02:26 2002 From: joe@REDACTED (Joe Armstrong) Date: Wed, 22 May 2002 15:02:26 +0200 (CEST) Subject: TeX parser Message-ID: Has anybody written a TeX parser in Erlang? /Joe From fredrik.linder@REDACTED Wed May 22 15:02:49 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 22 May 2002 15:02:49 +0200 Subject: Compiler crash Message-ID: Hi compiler creators When I compile apa_bad.erl does erlc crash, but with apa_good.erl is doesn't. /home/fredli/[...]/apa_bad.erl:none: internal error in v3_core; crash reason: {{case_clause,{'EXIT',{function_clause, [{v3_core, pat_alias, [{c_atom,[],type}, {c_atom,[],eme_lir}]}, {lists,map,2}, {v3_core,clause,2}, {lists,mapfoldl,3}, {v3_core,body,3}, {v3_core,function,1}, {v3_core,form,2}, {lists,foldr,3}| more]}}}, [{compile,'-select_passes/2-fun-2-',2}, {compile,'-internal_comp/4-fun-1-',2}, {compile,fold_comp,3}, {compile,internal_comp,4}, {compile,internal,3}]} What information do you need to debug this, and how do I retrieve it? The version of erts is 5.0.1.1. /Fredrik http://skrivihop.nu -------------- next part -------------- A non-text attachment was scrubbed... Name: apa_bad.erl Type: application/octet-stream Size: 731 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: apa_good.erl Type: application/octet-stream Size: 520 bytes Desc: not available URL: From fredrik.linder@REDACTED Wed May 22 15:11:48 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 22 May 2002 15:11:48 +0200 Subject: Compiler crash In-Reply-To: Message-ID: The problem seemes to occurr with gec_svc_tag/1. Redefining it as below removes the compiler crash: get_svc_init(Type) -> case Type of slia -> svc_result; eme_lia -> svc_result; slir -> svc_init; eme_lir -> svc_init end. /Fredrik > -----Original Message----- > From: Fredrik Linder [mailto:fredrik.linder@REDACTED] > Sent: den 22 maj 2002 15:03 > To: erlang-questions@REDACTED > Subject: Compiler crash > > > Hi compiler creators > > When I compile apa_bad.erl does erlc crash, but with apa_good.erl is > doesn't. > > /home/fredli/[...]/apa_bad.erl:none: internal error in v3_core; > crash reason: {{case_clause,{'EXIT',{function_clause, > [{v3_core, > pat_alias, > [{c_atom,[],type}, > {c_atom,[],eme_lir}]}, > {lists,map,2}, > {v3_core,clause,2}, > {lists,mapfoldl,3}, > {v3_core,body,3}, > {v3_core,function,1}, > {v3_core,form,2}, > {lists,foldr,3}| > more]}}}, > [{compile,'-select_passes/2-fun-2-',2}, > {compile,'-internal_comp/4-fun-1-',2}, > {compile,fold_comp,3}, > {compile,internal_comp,4}, > {compile,internal,3}]} > > What information do you need to debug this, and how do I retrieve it? > > The version of erts is 5.0.1.1. > > /Fredrik > > http://skrivihop.nu > From happi@REDACTED Wed May 22 15:19:00 2002 From: happi@REDACTED (Happi) Date: Wed, 22 May 2002 15:19:00 +0200 Subject: Compiler crash References: Message-ID: <00f001c20193$3c8b0800$c90b0a0a@LISA> A slightly unrelated question to the Erlang community: would you like a compiler warning for a construct like get_svc_tag(type = eme_lir) -> svc_init. ? (From Fredrik Linders apa_bad.erl) It is completely valid code but it is also almost certainly a bug. I for one would like such a warning. -------------------------------------- I'm Happi, you should be happy. Praeterea censeo 0xCA scribere Erlang posse. From richardc@REDACTED Wed May 22 15:18:32 2002 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 22 May 2002 15:18:32 +0200 (MET DST) Subject: Compiler crash In-Reply-To: Message-ID: On Wed, 22 May 2002, Fredrik Linder wrote: > When I compile apa_bad.erl does erlc crash, but with apa_good.erl is > doesn't. > > crash reason: {{case_clause,{'EXIT',{function_clause, > [{v3_core, > pat_alias, > [{c_atom,[],type}, > {c_atom,[],eme_lir}]}, The error is this clause in apa_bad.erl: get_svc_tag(type = eme_lir) ->?svc_init. "type" should have been "Type". The compiler (R9) has apparently already been extended to ``handle'' such incompatible aliases by quietly making the clause unselectable, but this should preferably be detected by erl_lint so that you would get an error message instead. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From fredrik.linder@REDACTED Wed May 22 15:20:14 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Wed, 22 May 2002 15:20:14 +0200 Subject: Compiler crash In-Reply-To: Message-ID: Thanx, clumsy of me :) /Fredrik > -----Original Message----- > From: Richard Carlsson [mailto:richardc@REDACTED] > Sent: den 22 maj 2002 15:19 > To: Fredrik Linder > Cc: erlang-questions@REDACTED > Subject: Re: Compiler crash > > > > On Wed, 22 May 2002, Fredrik Linder wrote: > > > When I compile apa_bad.erl does erlc crash, but with apa_good.erl is > > doesn't. > > > > crash reason: {{case_clause,{'EXIT',{function_clause, > > [{v3_core, > > pat_alias, > > [{c_atom,[],type}, > > {c_atom,[],eme_lir}]}, > > The error is this clause in apa_bad.erl: > > get_svc_tag(type = eme_lir) ->?svc_init. > > "type" should have been "Type". The compiler (R9) has apparently already > been extended to ``handle'' such incompatible aliases by quietly making > the clause unselectable, but this should preferably be detected by > erl_lint so that you would get an error message instead. > > /Richard > > > Richard Carlsson (richardc@REDACTED) (This space intentionally > left blank.) > E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ > "Having users is like optimization: the wise course is to delay it." > -- Paul Graham > > > From vlad_dumitrescu@REDACTED Wed May 22 16:06:04 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Wed, 22 May 2002 16:06:04 +0200 Subject: Compiler crash Message-ID: >From: "Happi" >A slightly unrelated question to the Erlang community: > would you like a compiler warning for a construct like > get_svc_tag(type = eme_lir) -> svc_init. > ? I would like to get all possible warnings, like C-lint. Of course, configurable so that they don't always clutter the output. Could that be a sign that I am sloppy when writing code? :-D regards Vlad _________________________________________________________________ Chatta med kompisar online, prova MSN Messenger: http://messenger.msn.com From ingela@REDACTED Wed May 22 17:17:20 2002 From: ingela@REDACTED (Ingela Anderton) Date: Wed, 22 May 2002 17:17:20 +0200 (MEST) Subject: Records, encapsulation and optional elements Message-ID: <200205221517.RAA05575@gildor.du.uab.ericsson.se> Alex Peake wrote: > Sorry Ingela, when I said "much more elegant" I meant much more elegant than > *my* solution. I was not referring to your solution. Your's is "much more > elegant" too! Well thank you :) But there still was a bug in it! > I am very new to Erlang, so my attempts are rather clumsy as I learn. > > I thought Willem's code was in the class of "dirty tricks" since (to quote > Willem): > > % We make use of knowledge about implementation of records. > % It's bad style, but so very useful! ;-) > > Am I right here, or is it just my newness to the Erlang world? You are right. We are getting things mixed up here, or atleast I was. I was really refering to Vladimir Sekissov solotion as the on that I thought was cleaner. And I do not like Williems (sorry Williem) as it uses dirty tricks. -- /m.v.h Ingela //The highway of life is always under construction. // |\ _,,,--,,_ ,) /,`.-'`' -, ;-;;' |,4- ) )-,_ ) /\ '---''(_/--' (_/-' Ericsson AB - OTP team Cellular/Mobile: +46 70 636 78 68 From twanvds@REDACTED Thu May 23 01:25:46 2002 From: twanvds@REDACTED (Twan van der Schoot) Date: Thu, 23 May 2002 01:25:46 +0200 Subject: Communicating with Java node Message-ID: <01C201F8.C475D910.twanvds@xs4all.nl> Hi Vlad, As far as I understand it from reading the maillist (from Raimo Niskanen [raimo@REDACTED] 200020515 12:19 with subject line "Re: File locking & device drivers"), quoted: ... Is this not more of a general flow control problem. Asynchronous message passing is THE way to synchronize processes in Erlang. If you have a server that passes messages to somewhere (a file while guarding all writes with 'flock') and many clients just feeding the server (no request/reply message passing), the server message queue might grow in this case affecting the server's ability to serve requests since these client messages gets in the way of more important messages. There is a mechanism in the Erlang emulator (virtual machine) that compensates for this problem. A process that sends a message to another process with a large message queue gets punished with getting sheduled out sooner. This mechanism diminsishes this producer/consumer problem. ... The last paragraph, I believe, is the answer to your question. kr Twan On Tuesday, May 21, 2002 8:57 AM, Vlad Dumitrescu wrote: > Hi all, > > I have a problem that I can't find the cause, and hope someone might know > the answer. > > I have an Erlang and a Java node communicating with each other. I noticed > that if an Erlang process sends many messages to a Java process, then it is > sometimes being slowed down, as if it was waiting for some response (which > is not the case). The delay occurs when the Java process, upon receiving the > message, writes something to the console... The difference for 1000 messages > is ~500 ms when Java only reads the msg, and ~2200 ms when the receive is > followed by an System.out.println. The delay seems to be independent of how > much text is written. > > Is it something that I do wrong, or is it normal behaviour, or is there a > bug? Thanks in advance, > > Vlad > > Erlang code: > -module(tt). > -compile(export_all). > go(0)-> ok; > go(N) -> {main, java@REDACTED} ! {self(), hello}, go(N-1). > > shell> timer:tc(tt, go, [999]). > > Java code: > import com.ericsson.otp.erlang.*; > class App { > public static main(String[] args) > { > try { > OtpErlangNode node = new OtpErlangNode("java"); > OtpErlangMbox mbox = node.createMbox("main"); > while(true) > { > OtpErlangObject msg = mbox.receive(); > // System.out.println("got: "+msg.toString()); > } > } catch (Exception ex) {} > } > } > > > > _________________________________________________________________ > Chatta med kompisar online, prova MSN Messenger: http://messenger.msn.com > From vlad_dumitrescu@REDACTED Thu May 23 07:00:15 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 23 May 2002 07:00:15 +0200 Subject: GS user/kernel namespaces Message-ID: Hi, I wonder what is the meaning of the kernel and user address spaces used in gstk? (i.e. the use of even and odd numbers as references to tk objects) Is it an internal housekeeping thing, or is there a deeper meaning that escapes me? Thanks. Best regards, Vlad _________________________________________________________________ MSN Foto ?r det enklaste s?ttet att dela eller skaffa papperskopior av dina foton: http://photos.msn.com/support/worldwide.aspx From apeake@REDACTED Fri May 24 05:56:02 2002 From: apeake@REDACTED (Alex Peake) Date: Thu, 23 May 2002 20:56:02 -0700 Subject: Higher Order Function Question Message-ID: Can someone help me with this (no doubt simple) problem. I try: 1> attr:isPk(Attr). false 2> not attr:isPk(Attr). true 3> not(attr:isPk(Attr)). true but cannot find a permutation/combination of: 4> apply({attr, isPk}, [A1]). false that can include "not" and work. Actually, I am trying to lists:filter( ...not isPk... SomeList). The simple is to define notIsPk(Attr), or perhaps lists:filter( fun(Attr) -> .. end but they are not an abstraction of "complement". Perhaps I should define a function complement(Fn) that returns a function that is the complement of the function passed? Perhaps there is already an Erlang way to do this (I hope). Alex From apeake@REDACTED Fri May 24 05:57:43 2002 From: apeake@REDACTED (Alex Peake) Date: Thu, 23 May 2002 20:57:43 -0700 Subject: Ets Question Message-ID: I am using ets at the "top level" as I experiment and develop my program. Unfortunatley, every time I make an error, I lose all my dictionaries and have to re-initialize. How am I supposed to do this? Thanks, Alex From hakan@REDACTED Fri May 24 08:20:15 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 24 May 2002 08:20:15 +0200 (MEST) Subject: Ets Question In-Reply-To: Message-ID: On Thu, 23 May 2002, Alex Peake wrote: Alex> I am using ets at the "top level" as I experiment and develop my program. Alex> Alex> Unfortunatley, every time I make an error, I lose all my dictionaries and Alex> have to re-initialize. Alex> Alex> How am I supposed to do this? The trick is to keep the process that owns your ets-tables alive. Misspellings and other errors may easily cause your shell process to die. When working interactively in the Erlang shell you can use two shells. Create the tables in one shell, start yet another shell (control-g, s, c) and go ahead and make all the errors that you need. ;-) /H?kan --- H?kan Mattsson Ericsson Computer Science Laboratory http://www.ericsson.com/cslab/~hakan/ From raimo@REDACTED Fri May 24 09:17:38 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Fri, 24 May 2002 09:17:38 +0200 Subject: Higher Order Function Question References: Message-ID: <3CEDE912.57E6C26@erix.ericsson.se> I cannot come up with anything better than: lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) or complement(Fun) -> fun (Attr) -> not Fun(Attr) end. lists:filter(complement({attr, isPk}), SomeList) % or lists:filter(complement(fun isPk/1), SomeList) % within module 'attr' % or lists:filter(complement(fun(Attr) -> attr:isPk(Attr) end, SomeList) % Very pointless with the complement() function / Raimo Niskanen, Erlang/OTP, Ericsson AB Alex Peake wrote: > > Can someone help me with this (no doubt simple) problem. > > I try: > > 1> attr:isPk(Attr). > false > > 2> not attr:isPk(Attr). > true > > 3> not(attr:isPk(Attr)). > true > > but cannot find a permutation/combination of: > > 4> apply({attr, isPk}, [A1]). > false > > that can include "not" and work. > > Actually, I am trying to lists:filter( ...not isPk... SomeList). > > The simple is to define notIsPk(Attr), or perhaps lists:filter( fun(Attr) -> > .. end but they are not an abstraction of "complement". > > Perhaps I should define a function complement(Fn) that returns a function > that is the complement of the function passed? > > Perhaps there is already an Erlang way to do this (I hope). > > Alex From richardc@REDACTED Fri May 24 11:09:38 2002 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 24 May 2002 11:09:38 +0200 (MET DST) Subject: Higher Order Function Question In-Reply-To: <3CEDE912.57E6C26@erix.ericsson.se> Message-ID: On Fri, 24 May 2002, Raimo Niskanen wrote: > I cannot come up with anything better than: > > lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) > > or > > complement(Fun) -> fun (Attr) -> not Fun(Attr) end. > > lists:filter(complement({attr, isPk}), SomeList) > % or > lists:filter(complement(fun isPk/1), SomeList) % within module 'attr' > % or > lists:filter(complement(fun(Attr) -> attr:isPk(Attr) end, SomeList) % > Very pointless with the complement() function > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > Alex Peake wrote: > > > > Can someone help me with this (no doubt simple) problem. > > > > I try: > > > > 1> attr:isPk(Attr). > > false > > > > 2> not attr:isPk(Attr). > > true > > > > 3> not(attr:isPk(Attr)). > > true > > > > but cannot find a permutation/combination of: > > > > 4> apply({attr, isPk}, [A1]). > > false > > > > that can include "not" and work. > > > > Actually, I am trying to lists:filter( ...not isPk... SomeList). > > > > The simple is to define notIsPk(Attr), or perhaps lists:filter( fun(Attr) -> > > .. end but they are not an abstraction of "complement". > > > > Perhaps I should define a function complement(Fn) that returns a function > > that is the complement of the function passed? > > > > Perhaps there is already an Erlang way to do this (I hope). > > > > Alex > Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From richardc@REDACTED Fri May 24 11:22:53 2002 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 24 May 2002 11:22:53 +0200 (MET DST) Subject: Higher Order Function Question In-Reply-To: <3CEDE912.57E6C26@erix.ericsson.se> Message-ID: (Sorry for the previous one - I hit "send" by mistake.) A list comprehension is a bit easier to read, and executes faster (becomes a local recursive function): [X || X <- SomeList, not attr:isPk(X)] > lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) Yes, this is the way to do it if you prefer to use lists:filter. And there is not much of a point in defining a "complement" function unless you really need it often in your program. > > 4> apply({attr, isPk}, [A1]). Please forget that this form of function call ever existed. Use F(...) where F = fun ..., or M:F(...) where M and F are atoms. Only use apply(M, F, [...]) when you really, really cannot find an alternative. /Richard On Fri, 24 May 2002, Raimo Niskanen wrote: > I cannot come up with anything better than: > > lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) > > or > > complement(Fun) -> fun (Attr) -> not Fun(Attr) end. > > lists:filter(complement({attr, isPk}), SomeList) > % or > lists:filter(complement(fun isPk/1), SomeList) % within module 'attr' > % or > lists:filter(complement(fun(Attr) -> attr:isPk(Attr) end, SomeList) % > Very pointless with the complement() function > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > Alex Peake wrote: > > > > Can someone help me with this (no doubt simple) problem. > > > > I try: > > > > 1> attr:isPk(Attr). > > false > > > > 2> not attr:isPk(Attr). > > true > > > > 3> not(attr:isPk(Attr)). > > true > > > > but cannot find a permutation/combination of: > > > > 4> apply({attr, isPk}, [A1]). > > false > > > > that can include "not" and work. > > > > Actually, I am trying to lists:filter( ...not isPk... SomeList). > > > > The simple is to define notIsPk(Attr), or perhaps lists:filter( fun(Attr) -> > > .. end but they are not an abstraction of "complement". > > > > Perhaps I should define a function complement(Fn) that returns a function > > that is the complement of the function passed? > > > > Perhaps there is already an Erlang way to do this (I hope). > > > > Alex > Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From apeake@REDACTED Fri May 24 17:27:22 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 24 May 2002 08:27:22 -0700 Subject: Higher Order Function Question In-Reply-To: <3CEDE912.57E6C26@erix.ericsson.se> Message-ID: Richard, Thanks you for the list comprehension suggestion. I had not thought of that (it does not exist in the Lisp world where I come from). I do use complement a lot, so I think, for me, it is worth the definition -- but perhaps if I re-examine my approach, list comprehensions may obviate the need. As for 4> apply({attr, isPk}, [A1]). as I mentioned, I was just testing for eventual use in filter, and as far as I know, in filter (and map, etc.) you *must* use the form {attr, isPk}. I always get errors when I try attr:isPk within map, filter etc. 150> lists:map(attr:varName, rel:attrList(rel:findNamed(ng,"Member"))). ** exited: {{badexpr,':'},[{erl_eval,expr,3}]} ** Thanks, Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Raimo Niskanen > Sent: Friday, May 24, 2002 12:18 AM > To: erlang-questions@REDACTED > Subject: Re: Higher Order Function Question > > > I cannot come up with anything better than: > > lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) > > or > > complement(Fun) -> fun (Attr) -> not Fun(Attr) end. > > lists:filter(complement({attr, isPk}), SomeList) > % or > lists:filter(complement(fun isPk/1), SomeList) % within > module 'attr' > % or > lists:filter(complement(fun(Attr) -> attr:isPk(Attr) end, > SomeList) % > Very pointless with the complement() function > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > Alex Peake wrote: > > > > Can someone help me with this (no doubt simple) problem. > > > > I try: > > > > 1> attr:isPk(Attr). > > false > > > > 2> not attr:isPk(Attr). > > true > > > > 3> not(attr:isPk(Attr)). > > true > > > > but cannot find a permutation/combination of: > > > > 4> apply({attr, isPk}, [A1]). > > false > > > > that can include "not" and work. > > > > Actually, I am trying to lists:filter( ...not isPk... SomeList). > > > > The simple is to define notIsPk(Attr), or perhaps lists:filter( > fun(Attr) -> > > .. end but they are not an abstraction of "complement". > > > > Perhaps I should define a function complement(Fn) that returns > a function > > that is the complement of the function passed? > > > > Perhaps there is already an Erlang way to do this (I hope). > > > > Alex > From apeake@REDACTED Fri May 24 18:03:17 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 24 May 2002 09:03:17 -0700 Subject: Higher Order Function Question In-Reply-To: Message-ID: Richard, Thanks you for the list comprehension suggestion. I had not thought of that (it does not exist in the Lisp world where I come from). I do use complement a lot, so I think, for me, it is worth the definition -- but perhaps if I re-examine my approach, list comprehensions may obviate the need. As for 4> apply({attr, isPk}, [A1]). as I mentioned, I was just testing for eventual use in filter, and as far as I know, in filter (and map, etc.) you *must* use the form {attr, isPk}. I always get errors when I try attr:isPk within map, filter etc. 150> lists:map(attr:varName, rel:attrList(rel:findNamed(ng,"Member"))). ** exited: {{badexpr,':'},[{erl_eval,expr,3}]} ** Thanks, Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Richard Carlsson > Sent: Friday, May 24, 2002 2:23 AM > To: raimo.niskanen@REDACTED > Cc: erlang-questions@REDACTED > Subject: Re: Higher Order Function Question > > > > (Sorry for the previous one - I hit "send" by mistake.) > > A list comprehension is a bit easier to read, and executes faster > (becomes a local recursive function): > > [X || X <- SomeList, not attr:isPk(X)] > > > lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) > > Yes, this is the way to do it if you prefer to use lists:filter. > And there is not much of a point in defining a "complement" function > unless you really need it often in your program. > > > > 4> apply({attr, isPk}, [A1]). > > Please forget that this form of function call ever existed. Use > > F(...) > > where F = fun ..., or > > M:F(...) > > where M and F are atoms. > > Only use apply(M, F, [...]) when you really, really cannot find an > alternative. > > /Richard > > > > On Fri, 24 May 2002, Raimo Niskanen wrote: > > > I cannot come up with anything better than: > > > > lists:filter(fun (Attr) -> not attr:isPk(Attr) end, SomeList) > > > > or > > > > complement(Fun) -> fun (Attr) -> not Fun(Attr) end. > > > > lists:filter(complement({attr, isPk}), SomeList) > > % or > > lists:filter(complement(fun isPk/1), SomeList) % within > module 'attr' > > % or > > lists:filter(complement(fun(Attr) -> attr:isPk(Attr) end, > SomeList) % > > Very pointless with the complement() function > > > > / Raimo Niskanen, Erlang/OTP, Ericsson AB > > > > > > > > > > Alex Peake wrote: > > > > > > Can someone help me with this (no doubt simple) problem. > > > > > > I try: > > > > > > 1> attr:isPk(Attr). > > > false > > > > > > 2> not attr:isPk(Attr). > > > true > > > > > > 3> not(attr:isPk(Attr)). > > > true > > > > > > but cannot find a permutation/combination of: > > > > > > 4> apply({attr, isPk}, [A1]). > > > false > > > > > > that can include "not" and work. > > > > > > Actually, I am trying to lists:filter( ...not isPk... SomeList). > > > > > > The simple is to define notIsPk(Attr), or perhaps > lists:filter( fun(Attr) -> > > > .. end but they are not an abstraction of "complement". > > > > > > Perhaps I should define a function complement(Fn) that > returns a function > > > that is the complement of the function passed? > > > > > > Perhaps there is already an Erlang way to do this (I hope). > > > > > > Alex > > > > Richard Carlsson (richardc@REDACTED) (This space intentionally > left blank.) > E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ > "Having users is like optimization: the wise course is to delay it." > -- Paul Graham > > From fredrik.linder@REDACTED Fri May 24 18:06:33 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Fri, 24 May 2002 18:06:33 +0200 Subject: Higher Order Function Question References: Message-ID: <001a01c2033c$fcbd9840$18b7f2d5@frelin> > As for > 4> apply({attr, isPk}, [A1]). > > as I mentioned, I was just testing for eventual use in filter, and as far as > I know, in filter (and map, etc.) you *must* use the form {attr, isPk}. I > always get errors when I try attr:isPk within map, filter etc. You *must* supply a fun, but there are three alternatives to define one, the one you chose I guess is considered to be the least elegant. Fun = {M, F} Fun = fun M:F/A, where A = arity (requires that M:F/A is a named existing function) Fun = fun(Arg) -> M:F(Arg) end The apply call above can even be written: {attr, isPk}(A1) %% !!! fun(X) -> attr:isPk(X) end(A1) or simply attr:isPk(A1) ;-) /Fredrik From etxhste@REDACTED Fri May 24 18:23:34 2002 From: etxhste@REDACTED (Hakan Stenholm) Date: Fri, 24 May 2002 18:23:34 +0200 (MET DST) Subject: Higher Order Function Question Message-ID: <200205241623.g4OGNYr27977@cbe.ericsson.se> >Richard, > >Thanks you for the list comprehension suggestion. I had not thought of that >(it does not exist in the Lisp world where I come from). > >I do use complement a lot, so I think, for me, it is worth the definition -- >but perhaps if I re-examine my approach, list comprehensions may obviate the >need. > >As for >4> apply({attr, isPk}, [A1]). > >as I mentioned, I was just testing for eventual use in filter, and as far as >I know, in filter (and map, etc.) you *must* use the form {attr, isPk}. I >always get errors when I try attr:isPk within map, filter etc. > >150> lists:map(attr:varName, rel:attrList(rel:findNamed(ng,"Member"))). >** exited: {{badexpr,':'},[{erl_eval,expr,3}]} ** > lists:map({attr,varName}, rel:attrList(rel:findNamed(ng,"Member"))). should work, see examples below: 1> lists:map({lists,append},[[[1],[2],[3]], [[b],[c]]]). [[1,2,3],[b,c]] 3> {lists,append}([[1,2,3],[a,b,c]]). [1,2,3,a,b,c] There are three basic ways to define a fun: Fun = fun(Arg1, Arg2 ....) -> ... end % anynomouse fun Fun = fun FunctionName/Arity % local fun in current file Fun = {Module, FunctionName} % any exported function can be used all which can be called as Fun(A1,A2, ....) as can be seen below: 2> fun(L) -> lists:append(L) end([[1,2,3],[a,b,c]]). [1,2,3,a,b,c] -------------------------------------- -module(test). -export([test/0, test_call/0]). head([A|_]) -> A. test_call() -> fun head/1([1,2,3,4]). --------------------------------------- 1> test:test_call(). 1 Ofcourse we usally write something like: Fun = .... Fun(A1,A2, ....) From apeake@REDACTED Sat May 25 01:48:16 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 24 May 2002 16:48:16 -0700 Subject: Higher Order Function Question In-Reply-To: <200205241623.g4OGNYr27977@cbe.ericsson.se> Message-ID: Thank you Haken, but the issue is not "apply" - I was only using that to experiment -- the issue is "map" or "filter" which, apparently, will only accept {attr, isPk} and not attr:isPk (which I am told is "more elegant" and certainly more efficient). map and filter will accept: lists:map(fun(Arg) -> attr:varName(Arg) end, rel:attrList(rel:findNamed(ng,"Member"))). but this is quite ugly looking code (albeit probably more efficient than {attr, isPk}... Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Hakan Stenholm > Sent: Friday, May 24, 2002 9:24 AM > To: erlang-questions@REDACTED > Cc: apeake@REDACTED > Subject: RE: Higher Order Function Question > > > >Richard, > > > >Thanks you for the list comprehension suggestion. I had not > thought of that > >(it does not exist in the Lisp world where I come from). > > > >I do use complement a lot, so I think, for me, it is worth the > definition -- > >but perhaps if I re-examine my approach, list comprehensions may > obviate the > >need. > > > >As for > >4> apply({attr, isPk}, [A1]). > > > >as I mentioned, I was just testing for eventual use in filter, > and as far as > >I know, in filter (and map, etc.) you *must* use the form {attr, isPk}. I > >always get errors when I try attr:isPk within map, filter etc. > > > >150> lists:map(attr:varName, rel:attrList(rel:findNamed(ng,"Member"))). > >** exited: {{badexpr,':'},[{erl_eval,expr,3}]} ** > > > > lists:map({attr,varName}, rel:attrList(rel:findNamed(ng,"Member"))). > should work, see examples below: > 1> lists:map({lists,append},[[[1],[2],[3]], [[b],[c]]]). > [[1,2,3],[b,c]] > 3> {lists,append}([[1,2,3],[a,b,c]]). > [1,2,3,a,b,c] > > There are three basic ways to define a fun: > Fun = fun(Arg1, Arg2 ....) -> ... end % anynomouse fun > Fun = fun FunctionName/Arity % local fun in current file > Fun = {Module, FunctionName} % any exported function can be used > > all which can be called as Fun(A1,A2, ....) as can be seen below: > > 2> fun(L) -> lists:append(L) end([[1,2,3],[a,b,c]]). > [1,2,3,a,b,c] > > -------------------------------------- > -module(test). > -export([test/0, > test_call/0]). > > head([A|_]) -> A. > > test_call() -> > fun head/1([1,2,3,4]). > --------------------------------------- > 1> test:test_call(). > 1 > > Ofcourse we usally write something like: > Fun = .... > Fun(A1,A2, ....) > > > > From apeake@REDACTED Sat May 25 07:36:00 2002 From: apeake@REDACTED (Alex Peake) Date: Fri, 24 May 2002 22:36:00 -0700 Subject: Ets Question In-Reply-To: Message-ID: Thanks for the suggestion Hakan, Trouble is, in the second shell, the table is not visible. 1> ets:lookup(vbDecl, varchar). ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, {erl_eval,expr,3}, {erl_eval,exprs,4}, {shell,eval_loop,2}]} ** =ERROR REPORT==== 24-May-2002::22:30:40 === Error in process <0.22.0> with exit value: {badarg,[{ets,lookup,[vbDecl,varchar]},{erl_eval,expr,3},{erl_eval,exprs,4}, {shell,eval_loop,2}]} But in the shell I start it in: 1> vbDecl:init(). true 2> ets:lookup(vbDecl, varchar). [{varchar,"As String"}] The above was in XEmacs. In the regular (werl) shell: Erlang (BEAM) emulator version 5.1.1 [threads:0] Eshell V5.1.1 (abort with ^G) 1> ets:lookup(vbDecl, varchar). =ERROR REPORT==== 24-May-2002::22:33:49 === Error in process <0.25.0> with exit value: {badarg,[{ets,lookup,[vbDecl,varchar] },{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]} ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, {erl_eval,expr,3}, {erl_eval,exprs,4}, {shell,eval_loop,2}]} ** Am I missing something? Alex > -----Original Message----- > From: hakan@REDACTED [mailto:hakan@REDACTED]On Behalf Of > Hakan Mattsson > Sent: Thursday, May 23, 2002 11:20 PM > To: Alex Peake > Cc: erlang-questions@REDACTED > Subject: Re: Ets Question > > > On Thu, 23 May 2002, Alex Peake wrote: > > Alex> I am using ets at the "top level" as I experiment and > develop my program. > Alex> > Alex> Unfortunatley, every time I make an error, I lose all my > dictionaries and > Alex> have to re-initialize. > Alex> > Alex> How am I supposed to do this? > > The trick is to keep the process that owns your ets-tables alive. > Misspellings and other errors may easily cause your shell process to die. > > When working interactively in the Erlang shell you can use two shells. > Create the tables in one shell, start yet another shell (control-g, s, c) > and go ahead and make all the errors that you need. ;-) > > /H?kan > > --- > H?kan Mattsson > Ericsson > Computer Science Laboratory > http://www.ericsson.com/cslab/~hakan/ > > From matthias@REDACTED Sat May 25 12:41:50 2002 From: matthias@REDACTED (Matthias Lang) Date: Sat, 25 May 2002 12:41:50 +0200 Subject: Ets Question In-Reply-To: References: Message-ID: <15599.27246.860455.750424@antilipe.corelatus.se> Hi, I can but guess what your vbDecl module is doing, perhaps you forgot to make the table a named table: Erlang (BEAM) emulator version 5.1.1 [source] Eshell V5.1.1 (abort with ^G) 1> self(). <0.23.0> 2> ets:new(mytable, [public, named_table]). mytable 3> User switch command --> s --> c Eshell V5.1.1 (abort with ^G) 1> self(). <0.43.0> 2> ets:lookup(mytable, bla). [] Matthias -------------------- Alex Peake writes: > Trouble is, in the second shell, the table is not visible. > > 1> ets:lookup(vbDecl, varchar). > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > {erl_eval,expr,3}, > {erl_eval,exprs,4}, > {shell,eval_loop,2}]} ** > > =ERROR REPORT==== 24-May-2002::22:30:40 === > Error in process <0.22.0> with exit value: > {badarg,[{ets,lookup,[vbDecl,varchar]},{erl_eval,expr,3},{erl_eval,exprs,4}, > {shell,eval_loop,2}]} > > But in the shell I start it in: > > 1> vbDecl:init(). > true > 2> ets:lookup(vbDecl, varchar). > [{varchar,"As String"}] > > The above was in XEmacs. In the regular (werl) shell: > > Erlang (BEAM) emulator version 5.1.1 [threads:0] > > Eshell V5.1.1 (abort with ^G) > 1> ets:lookup(vbDecl, varchar). > > =ERROR REPORT==== 24-May-2002::22:33:49 === > Error in process <0.25.0> with exit value: > {badarg,[{ets,lookup,[vbDecl,varchar] > },{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]} > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > {erl_eval,expr,3}, > {erl_eval,exprs,4}, > {shell,eval_loop,2}]} ** > > Am I missing something? > > Alex From hakan.stenholm@REDACTED Sat May 25 15:18:11 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 25 May 2002 15:18:11 +0200 Subject: Higher Order Function Question Message-ID: >Thank you Haken, > >but the issue is not "apply" - I was only using that to experiment >-- the issue is "map" or "filter" which, apparently, will only >accept {attr, isPk} and not attr:isPk (which I am told is "more >elegant" and certainly more efficient). > I think there has been slight missunderstanding here, apply(M,F,A) is the old classic version of how to call a fun, modern erlang supports funs to be called as F1(A) or M:F2(A) where F1 is a fun as defined previously: > Fun = fun(Arg1, Arg2 ....) -> ... end % anynomouse fun > Fun = fun FunctionName/Arity % local fun in current file > Fun = {Module, FunctionName} % any exported function can be used > but it is also possible for M and F2 to be arbitrary atoms i.e. this can also be done: % define this function my_apply(M,F2,A) -> M:F2(A). % this can be called as my_apply(lists,append,[[1,2],[3,4]]) % and result in [1,2,3,4] But "Fun = lists:append," (or similar construct) is not a legal way to define a fun. The F1(A) and M:F2(A) syntax is prefered to the apply(M,F,A) syntax because it's more efficent in most cases (see the "performance hints" link on the R8B documentation index.html page). >map and filter will accept: > >lists:map(fun(Arg) -> attr:varName(Arg) end, >rel:attrList(rel:findNamed(ng,"Member"))). > >but this is quite ugly looking code (albeit probably more efficient >than {attr, isPk}... > >>Alex -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1482 bytes Desc: not available URL: From apeake@REDACTED Sat May 25 17:42:57 2002 From: apeake@REDACTED (Alex Peake) Date: Sat, 25 May 2002 08:42:57 -0700 Subject: Ets Question In-Reply-To: <15599.27246.860455.750424@antilipe.corelatus.se> Message-ID: Thanks for the suggestion, but no, that is not the problem: ets:new(vbDecl,[set,public,named_table,{keypos,1}]) ets:insert(vbDecl,{varchar, "As String"}), Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Matthias Lang > Sent: Saturday, May 25, 2002 3:42 AM > To: Alex Peake > Cc: Hakan Mattsson; erlang-questions@REDACTED > Subject: RE: Ets Question > > > Hi, > > I can but guess what your vbDecl module is doing, perhaps you forgot > to make the table a named table: > > Erlang (BEAM) emulator version 5.1.1 [source] > > Eshell V5.1.1 (abort with ^G) > 1> self(). > <0.23.0> > 2> ets:new(mytable, [public, named_table]). > mytable > 3> > User switch command > --> s > --> c > Eshell V5.1.1 (abort with ^G) > 1> self(). > <0.43.0> > 2> ets:lookup(mytable, bla). > [] > > Matthias > > -------------------- > > Alex Peake writes: > > > Trouble is, in the second shell, the table is not visible. > > > > 1> ets:lookup(vbDecl, varchar). > > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > > {erl_eval,expr,3}, > > {erl_eval,exprs,4}, > > {shell,eval_loop,2}]} ** > > > > =ERROR REPORT==== 24-May-2002::22:30:40 === > > Error in process <0.22.0> with exit value: > > > {badarg,[{ets,lookup,[vbDecl,varchar]},{erl_eval,expr,3},{erl_eval > ,exprs,4}, > > {shell,eval_loop,2}]} > > > > But in the shell I start it in: > > > > 1> vbDecl:init(). > > true > > 2> ets:lookup(vbDecl, varchar). > > [{varchar,"As String"}] > > > > The above was in XEmacs. In the regular (werl) shell: > > > > Erlang (BEAM) emulator version 5.1.1 [threads:0] > > > > Eshell V5.1.1 (abort with ^G) > > 1> ets:lookup(vbDecl, varchar). > > > > =ERROR REPORT==== 24-May-2002::22:33:49 === > > Error in process <0.25.0> with exit value: > > {badarg,[{ets,lookup,[vbDecl,varchar] > > },{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]} > > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > > {erl_eval,expr,3}, > > {erl_eval,exprs,4}, > > {shell,eval_loop,2}]} ** > > > > Am I missing something? > > > > Alex > From apeake@REDACTED Sat May 25 18:08:15 2002 From: apeake@REDACTED (Alex Peake) Date: Sat, 25 May 2002 09:08:15 -0700 Subject: Higher Order Function Question In-Reply-To: Message-ID: Perhaps I could go back a step, to my orginal problem -- obviously not stated clearly: I was struggling to use "filter" with the "complement of" a predicate (in my case not attr:isPk). In explaining the problem, it came out that in my code I wrote things like: lists:map({attr,varName}, rel:attrList(rel:findNamed(ng,"Member"))). I was informed that this is "not elegant" and "inefficient" because it "is the old classic version of how to call a fun". So I asked for how to do this the "modern Erlang" way. I pointed out that: lists:map(fun(Arg) -> attr:varName(Arg) end, rel:attrList(rel:findNamed(ng,"Member"))). is more efficient, but as programmer reading this, I find the fun...end part makes the intent less clear. Similarly: Fn = fun attr:varName/1, lists:map(Fn, rel:attrList(rel:findNamed(ng,"Member"))). I also find cluttered. Richard Carlsson suggested the very elegant approach using list comprehensions: [attr:varName(Attr) || Attr <- rel:findNamed(ng,"Member")] This is what I am using. None-the-less, I am learning Erlang and am interested in the "moderen Erlang" way to use map, filter. Perhaps the answer is list comprehensions? Alex BTW, my solution to the filter with complement of a predicate, thanks to Richard, is: [attr:varName(Attr) || Attr <- rel:findNamed(ng,"Member"), not attr:isPk(Attr)] -----Original Message----- From: Hakan Stenholm [mailto:hakan.stenholm@REDACTED] Sent: Saturday, May 25, 2002 6:18 AM To: erlang-questions@REDACTED Cc: apeake@REDACTED Subject: RE: Higher Order Function Question >Thank you Haken, > >but the issue is not "apply" - I was only using that to experiment >-- the issue is "map" or "filter" which, apparently, will only >accept {attr, isPk} and not attr:isPk (which I am told is "more >elegant" and certainly more efficient). > I think there has been slight missunderstanding here, apply(M,F,A) is the old classic version of how to call a fun, modern erlang supports funs to be called as F1(A) or M:F2(A) where F1 is a fun as defined previously: > Fun = fun(Arg1, Arg2 ....) -> ... end % anynomouse fun > Fun = fun FunctionName/Arity % local fun in current file > Fun = {Module, FunctionName} % any exported function can be used > but it is also possible for M and F2 to be arbitrary atoms i.e. this can also be done: % define this function my_apply(M,F2,A) -> M:F2(A). % this can be called as my_apply(lists,append,[[1,2],[3,4]]) % and result in [1,2,3,4] But "Fun = lists:append," (or similar construct) is not a legal way to define a fun. The F1(A) and M:F2(A) syntax is prefered to the apply(M,F,A) syntax because it's more efficent in most cases (see the "performance hints" link on the R8B documentation index.html page). >map and filter will accept: > >lists:map(fun(Arg) -> attr:varName(Arg) end, >rel:attrList(rel:findNamed(ng,"Member"))). > >but this is quite ugly looking code (albeit probably more efficient >than {attr, isPk}... > >>Alex From thomas@REDACTED Sat May 25 18:27:32 2002 From: thomas@REDACTED (Thomas Lange) Date: Sat, 25 May 2002 18:27:32 +0200 Subject: Ets Question References: Message-ID: <3CEFBB74.ECDD298E@corelatus.com> Your problem is that you are running two erlang nodes ( different processes in OS ). They can never exchange data since you have no erlang distribution running. Every time you run werl, you launch a new node. In order to have 2 shells in the same node, do like Matthias did in his example ( ctrl-G ) to launch a second shell. /Thomas Alex Peake wrote: > > Thanks for the suggestion, but no, that is not the problem: > > ets:new(vbDecl,[set,public,named_table,{keypos,1}]) > ets:insert(vbDecl,{varchar, "As String"}), > > Alex > > > -----Original Message----- > > From: owner-erlang-questions@REDACTED > > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Matthias Lang > > Sent: Saturday, May 25, 2002 3:42 AM > > To: Alex Peake > > Cc: Hakan Mattsson; erlang-questions@REDACTED > > Subject: RE: Ets Question > > > > > > Hi, > > > > I can but guess what your vbDecl module is doing, perhaps you forgot > > to make the table a named table: > > > > Erlang (BEAM) emulator version 5.1.1 [source] > > > > Eshell V5.1.1 (abort with ^G) > > 1> self(). > > <0.23.0> > > 2> ets:new(mytable, [public, named_table]). > > mytable > > 3> > > User switch command > > --> s > > --> c > > Eshell V5.1.1 (abort with ^G) > > 1> self(). > > <0.43.0> > > 2> ets:lookup(mytable, bla). > > [] > > > > Matthias > > > > -------------------- > > > > Alex Peake writes: > > > > > Trouble is, in the second shell, the table is not visible. > > > > > > 1> ets:lookup(vbDecl, varchar). > > > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > > > {erl_eval,expr,3}, > > > {erl_eval,exprs,4}, > > > {shell,eval_loop,2}]} ** > > > > > > =ERROR REPORT==== 24-May-2002::22:30:40 === > > > Error in process <0.22.0> with exit value: > > > > > {badarg,[{ets,lookup,[vbDecl,varchar]},{erl_eval,expr,3},{erl_eval > > ,exprs,4}, > > > {shell,eval_loop,2}]} > > > > > > But in the shell I start it in: > > > > > > 1> vbDecl:init(). > > > true > > > 2> ets:lookup(vbDecl, varchar). > > > [{varchar,"As String"}] > > > > > > The above was in XEmacs. In the regular (werl) shell: > > > > > > Erlang (BEAM) emulator version 5.1.1 [threads:0] > > > > > > Eshell V5.1.1 (abort with ^G) > > > 1> ets:lookup(vbDecl, varchar). > > > > > > =ERROR REPORT==== 24-May-2002::22:33:49 === > > > Error in process <0.25.0> with exit value: > > > {badarg,[{ets,lookup,[vbDecl,varchar] > > > },{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]} > > > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > > > {erl_eval,expr,3}, > > > {erl_eval,exprs,4}, > > > {shell,eval_loop,2}]} ** > > > > > > Am I missing something? > > > > > > Alex > > From apeake@REDACTED Sat May 25 23:55:21 2002 From: apeake@REDACTED (Alex Peake) Date: Sat, 25 May 2002 14:55:21 -0700 Subject: Ets Question In-Reply-To: <3CEFBB74.ECDD298E@corelatus.com> Message-ID: Great! Thank you Thomas. Is there a way to do this in XEmacs (which is a *much* more friendly way to develop)? Alex > -----Original Message----- > From: tle@REDACTED [mailto:tle@REDACTED]On Behalf Of > Thomas Lange > Sent: Saturday, May 25, 2002 9:28 AM > To: Alex Peake > Cc: erlang-questions@REDACTED > Subject: Re: Ets Question > > > Your problem is that you are running two erlang > nodes ( different processes in OS ). > They can never exchange data since you have no erlang > distribution running. > > Every time you run werl, you launch a new node. > > In order to have 2 shells in the same node, do like > Matthias did in his example ( ctrl-G ) to launch > a second shell. > > /Thomas > > > Alex Peake wrote: > > > > Thanks for the suggestion, but no, that is not the problem: > > > > ets:new(vbDecl,[set,public,named_table,{keypos,1}]) > > ets:insert(vbDecl,{varchar, "As String"}), > > > > Alex > > > > > -----Original Message----- > > > From: owner-erlang-questions@REDACTED > > > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Matthias Lang > > > Sent: Saturday, May 25, 2002 3:42 AM > > > To: Alex Peake > > > Cc: Hakan Mattsson; erlang-questions@REDACTED > > > Subject: RE: Ets Question > > > > > > > > > Hi, > > > > > > I can but guess what your vbDecl module is doing, perhaps you forgot > > > to make the table a named table: > > > > > > Erlang (BEAM) emulator version 5.1.1 [source] > > > > > > Eshell V5.1.1 (abort with ^G) > > > 1> self(). > > > <0.23.0> > > > 2> ets:new(mytable, [public, named_table]). > > > mytable > > > 3> > > > User switch command > > > --> s > > > --> c > > > Eshell V5.1.1 (abort with ^G) > > > 1> self(). > > > <0.43.0> > > > 2> ets:lookup(mytable, bla). > > > [] > > > > > > Matthias > > > > > > -------------------- > > > > > > Alex Peake writes: > > > > > > > Trouble is, in the second shell, the table is not visible. > > > > > > > > 1> ets:lookup(vbDecl, varchar). > > > > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > > > > {erl_eval,expr,3}, > > > > {erl_eval,exprs,4}, > > > > {shell,eval_loop,2}]} ** > > > > > > > > =ERROR REPORT==== 24-May-2002::22:30:40 === > > > > Error in process <0.22.0> with exit value: > > > > > > > {badarg,[{ets,lookup,[vbDecl,varchar]},{erl_eval,expr,3},{erl_eval > > > ,exprs,4}, > > > > {shell,eval_loop,2}]} > > > > > > > > But in the shell I start it in: > > > > > > > > 1> vbDecl:init(). > > > > true > > > > 2> ets:lookup(vbDecl, varchar). > > > > [{varchar,"As String"}] > > > > > > > > The above was in XEmacs. In the regular (werl) shell: > > > > > > > > Erlang (BEAM) emulator version 5.1.1 [threads:0] > > > > > > > > Eshell V5.1.1 (abort with ^G) > > > > 1> ets:lookup(vbDecl, varchar). > > > > > > > > =ERROR REPORT==== 24-May-2002::22:33:49 === > > > > Error in process <0.25.0> with exit value: > > > > {badarg,[{ets,lookup,[vbDecl,varchar] > > > > },{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]} > > > > ** exited: {badarg,[{ets,lookup,[vbDecl,varchar]}, > > > > {erl_eval,expr,3}, > > > > {erl_eval,exprs,4}, > > > > {shell,eval_loop,2}]} ** > > > > > > > > Am I missing something? > > > > > > > > Alex > > > > From hakan.stenholm@REDACTED Sat May 25 15:18:11 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sat, 25 May 2002 15:18:11 +0200 Subject: Higher Order Function Question Message-ID: >Thank you Haken, > >but the issue is not "apply" - I was only using that to experiment >-- the issue is "map" or "filter" which, apparently, will only >accept {attr, isPk} and not attr:isPk (which I am told is "more >elegant" and certainly more efficient). > I think there has been slight missunderstanding here, apply(M,F,A) is the old classic version of how to call a fun, modern erlang supports funs to be called as F1(A) or M:F2(A) where F1 is a fun as defined previously: > Fun = fun(Arg1, Arg2 ....) -> ... end % anynomouse fun > Fun = fun FunctionName/Arity % local fun in current file > Fun = {Module, FunctionName} % any exported function can be used > but it is also possible for M and F2 to be arbitrary atoms i.e. this can also be done: % define this function my_apply(M,F2,A) -> M:F2(A). % this can be called as my_apply(lists,append,[[1,2],[3,4]]) % and result in [1,2,3,4] But "Fun = lists:append," (or similar construct) is not a legal way to define a fun. The F1(A) and M:F2(A) syntax is prefered to the apply(M,F,A) syntax because it's more efficent in most cases (see the "performance hints" link on the R8B documentation index.html page). >map and filter will accept: > >lists:map(fun(Arg) -> attr:varName(Arg) end, >rel:attrList(rel:findNamed(ng,"Member"))). > >but this is quite ugly looking code (albeit probably more efficient >than {attr, isPk}... > >>Alex -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1482 bytes Desc: not available URL: From hakan.stenholm@REDACTED Sun May 26 23:35:40 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Sun, 26 May 2002 23:35:40 +0200 Subject: Higher Order Function Question In-Reply-To: Message-ID: <86700B4E-70F0-11D6-BDA7-003065B5F8B4@mbox304.swipnet.se> On l?rdag, maj 25, 2002, at 06:08 , Alex Peake wrote: > Perhaps I could go back a step, to my orginal problem -- obviously not > stated clearly: > > I was struggling to use "filter" with the "complement of" a predicate > (in my > case not attr:isPk). > > In explaining the problem, it came out that in my code I wrote things > like: > > lists:map({attr,varName}, rel:attrList(rel:findNamed(ng,"Member"))). > > I was informed that this is "not elegant" and "inefficient" because it > "is > the old classic version of how to call a fun". > > So I asked for how to do this the "modern Erlang" way. I pointed out > that: > > lists:map(fun(Arg) -> attr:varName(Arg) end, > rel:attrList(rel:findNamed(ng,"Member"))). > > is more efficient, but as programmer reading this, I find the fun...end > part > makes the intent less clear. > > > Similarly: > > Fn = fun attr:varName/1, > lists:map(Fn, rel:attrList(rel:findNamed(ng,"Member"))). > > I also find cluttered. > > Richard Carlsson suggested the very elegant approach using list > comprehensions: > > [attr:varName(Attr) || Attr <- rel:findNamed(ng,"Member")] > > This is what I am using. > > > None-the-less, I am learning Erlang and am interested in the "moderen > Erlang" way to use map, filter. Perhaps the answer is list > comprehensions? > > I would say yes, list comprehension is very elegant for filters (and generators). I don't think I ever used lists:filter - I usally use lists:foldl (if map and foreach can't be used), I like foldl because it's very flexible and used to be faster than list comprehension (R5-6 ?). From eedfang@REDACTED Mon May 27 08:40:30 2002 From: eedfang@REDACTED (Faustin Ngokse) Date: Mon, 27 May 2002 08:40:30 +0200 (MET DST) Subject: How to remove quotation marks Message-ID: <200205270640.IAA10453@meto71.eed.ericsson.se> Hi erlang friends, I don't know if some of you solved this problem before; I have an erlang term enclosed in quotation marks and I just want to remove the quotation marks. Does anyone know an elegant way how to do that? example: How to transform List = "[{hello1}, {hello2}]" into Term = [{hello1}, {hello2}] Thanks in advance /// Faustin From sam@REDACTED Mon May 27 09:10:55 2002 From: sam@REDACTED (Samuel Tardieu) Date: Mon, 27 May 2002 09:10:55 +0200 Subject: How to remove quotation marks In-Reply-To: <200205270640.IAA10453@meto71.eed.ericsson.se> References: <200205270640.IAA10453@meto71.eed.ericsson.se> Message-ID: <2002-05-27-09-10-55+trackit+sam@inf.enst.fr> On 27/05, Faustin Ngokse wrote: | I have an erlang term enclosed in quotation marks and I just want to | remove the quotation marks. | Does anyone know an elegant way how to do that? | | example: | How to transform | List = "[{hello1}, {hello2}]" | into | Term = [{hello1}, {hello2}] The Erlang shell does that, the full source should be available on your system (look for shell.erl and erl_eval.erl). Sam From etxuwig@REDACTED Mon May 27 09:17:28 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 27 May 2002 09:17:28 +0200 (MET DST) Subject: How to remove quotation marks In-Reply-To: <200205270640.IAA10453@meto71.eed.ericsson.se> Message-ID: 1> List = "[{hello1}, {hello2}]". "[{hello1}, {hello2}]" 2> {ok,Tokens,_} = erl_scan:string(List ++ "."). {ok,[{'[',1}, {'{',1}, {atom,1,hello1}, {'}',1}, {',',1}, {'{',1}, {atom,1,hello2}, {'}',1}, {']',1}, {dot,1}], 1} 3> erl_parse:parse_term(Tokens). {ok,[{hello1},{hello2}]} /Uffe On Mon, 27 May 2002, Faustin Ngokse wrote: >Hi erlang friends, > >I don't know if some of you solved this problem before; >I have an erlang term enclosed in quotation marks and I just >want to remove the quotation marks. >Does anyone know an elegant way how to do that? > >example: >How to transform >List = "[{hello1}, {hello2}]" >into >Term = [{hello1}, {hello2}] > >Thanks in advance >/// Faustin > > -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From richardc@REDACTED Mon May 27 16:05:39 2002 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 27 May 2002 16:05:39 +0200 (MET DST) Subject: Higher Order Function Question In-Reply-To: Message-ID: On Sat, 25 May 2002, Alex Peake wrote: > I was struggling to use "filter" with the "complement of" a predicate (in my > case not attr:isPk). > > In explaining the problem, it came out that in my code I wrote things like: > > lists:map({attr,varName}, rel:attrList(rel:findNamed(ng,"Member"))). > > I was informed that this is "not elegant" and "inefficient" because it "is > the old classic version of how to call a fun". In the bad old days, there were no lambda closures at all in Erlang, and this 2-tuple thing was added as a kind of simple poor man's lambda. But things have improved since then, and the ability of 'apply' to interpret 2-tuples as function values is really something that is best forgotten. Really. > lists:map(fun(Arg) -> attr:varName(Arg) end, > rel:attrList(rel:findNamed(ng,"Member"))). > > is more efficient, but as programmer reading this, I find the > fun...end part makes the intent less clear. I'd claim the opposite, in fact. First, the "fun (...) -> ... end" clearly shows what the operation to be passed to "map" is. Second, the call "attr:varName(...)" makes it apparent that we are calling a certain function (with a certain arity) in a certain module, and what the arguments to that function will be. Of course it requires a few more characters to type, but as a programming pattern it is both cleaner and more powerful. If the function was a local one (in the same module), you could write lists:map(fun varName/1, MyList) but there is no notation "fun M:F/A" for functions in other modules, because of the way inter-module ("remote") calls work with dynamic code replacement in Erlang. List comprehensions are of course very elegant, but only work for operations that are combinations of map/filter. Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From etxdawd@REDACTED Mon May 27 17:03:10 2002 From: etxdawd@REDACTED (Dariab Wahed) Date: Mon, 27 May 2002 17:03:10 +0200 Subject: How to compare two lists? Message-ID: <3CF24AAE.81C2F06A@cbe.ericsson.se> Hi! Can you help me, How to compare two lists? eg. my_func(List1,List2) if List1 == List2 -> ok; List1/= List2 -> {error,"error!!!!"}; end. From lennart.ohman@REDACTED Mon May 27 17:25:38 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Mon, 27 May 2002 17:25:38 +0200 Subject: How to compare two lists? References: <3CF24AAE.81C2F06A@cbe.ericsson.se> Message-ID: <3CF24FF2.28C74BA2@st.se> Hi Dariab! Comparing lists is a process of first comparing the head of the list, and if no difference seen, comparing the tails of the lists. This means that "you" have to traverse the list until you find the difference, or the entire list to establish that they are equal. If you have already traversed the list in order to try to see if they are equal, you shall not do it again to see if they are not equal. My suggestion is: my_func(L1,L2) -> if L1 == L2 -> equal; true -> not_equal end. Or perhaps: my_func(L1,L1) -> equal; my_func(_,_) -> not_equal. Of course depending on where you are going to use this, but it is often considered good practise to not assume anything about what the caller of the function will use the result for. In other words, sometimes two lists being equal is the desired result, other times the opposite. That is why I choose 'equal' and 'not_equal' as return values rather than {error,...}. Best Regards, Lennart Dariab Wahed wrote: > > Hi! > Can you help me, > > How to compare two lists? > eg. > > my_func(List1,List2) > if > List1 == List2 -> ok; > List1/= List2 -> {error,"error!!!!"}; > end. -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From fredrik.linder@REDACTED Mon May 27 18:21:09 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Mon, 27 May 2002 18:21:09 +0200 Subject: Higher Order Function Question References: Message-ID: <002901c2059a$82bfb720$7db7f2d5@frelin> > but there is no notation "fun M:F/A" for functions in other modules, > because of the way inter-module ("remote") calls work with dynamic code > replacement in Erlang. You're right. At least I forgot that the M: part isn't supported. :-) But wouldn't it be nice to have that syntax though. (Could be syntactical suger for {M, F}) but I guess that would remove the /A check, if there is one) /Fredrik From richardc@REDACTED Mon May 27 18:29:36 2002 From: richardc@REDACTED (Richard Carlsson) Date: Mon, 27 May 2002 18:29:36 +0200 (MET DST) Subject: Higher Order Function Question In-Reply-To: <002901c2059a$82bfb720$7db7f2d5@frelin> Message-ID: On Mon, 27 May 2002, Fredrik Linder wrote: > > but there is no notation "fun M:F/A" for functions in other modules, > > But wouldn't it be nice to have that syntax though. (Could be > syntactical suger for {M, F}) but I guess that would remove the /A > check, if there is one) It has been suggested several times before, but is probably not a good idea, because of the difference between a fun and a remote call. A fun means "exactly the specified code, nothing else" while a remote-call means "whatever code is called M:F/A at this moment". There are several technical complications because of this, which could give a "fun M:F/A" some rather unexpected behaviour - not a good thing in Erlang. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From vances@REDACTED Mon May 27 21:28:07 2002 From: vances@REDACTED (Vance Shipley) Date: Mon, 27 May 2002 15:28:07 -0400 Subject: forget Message-ID: <20020527192807.GD33944@frogman.motivity.ca> Today I was bitten once again by the using the wrong variable. foo(Value) -> Value2 = bar(Value), Value3 = baz(Value2), Value4 = zab(Value3), {ok, Value4}. With something like the above I later add another step and everything has to be rewritten. If I forget a step somewhere it compiles and runs but the wrong value is used in the place where the code wasn't updated correctly. The idea of having the linter follow a coding style such as used above and warn when a variable version older than the most recently assigned is used was discussed on the list some time ago. That would have prevented me from tripping up today. Is that plan any closer to being implemented? The other thought I had was a forget() BIF like in the shell. Is that a bad idea? -Vance From kent@REDACTED Tue May 28 00:32:09 2002 From: kent@REDACTED (Kent Boortz) Date: 28 May 2002 00:32:09 +0200 Subject: forget In-Reply-To: <20020527192807.GD33944@frogman.motivity.ca> References: <20020527192807.GD33944@frogman.motivity.ca> Message-ID: Vance Shipley writes: > Today I was bitten once again by the using the wrong variable. > > foo(Value) -> > Value2 = bar(Value), > Value3 = baz(Value2), > Value4 = zab(Value3), > {ok, Value4}. > > With something like the above I later add another step and everything > has to be rewritten. If I forget a step somewhere it compiles and > runs but the wrong value is used in the place where the code wasn't > updated correctly. Some of these errors are catched using the compiler warning flag for unused variables. But not all of them. I set the flag with an environment variable, like ERL_COMPILER_OPTIONS=warn_unused_vars > The idea of having the linter follow a coding style such as used above > and warn when a variable version older than the most recently assigned > is used was discussed on the list some time ago. That would have > prevented me from tripping up today. > > Is that plan any closer to being implemented? I don't know if I misunderstand what you mean but one idea I have had is to use something similar to Prolog DCG (definite clause grammar) syntax so that the code can be written hiding the extra parameter passed around to every call. For example something like foo() --> bar(), % Call to other --> functions that return X = baz(), % implicitly return {AnyValue,HiddenVar} Val = v(), % Special call v() returns hidden parameter % at the point of the call. c(Value = zab(Val,X)), % Not a --> call, normal function call Value. could be expanded by the preprocessor to foo(S0) -> {_,S1} = bar(S0), {X,S2} = baz(S1), Val = S2, % or a call {Val,S3} = v(S2) if not special Value = zab(Val,X), {Value,S2}. % or {Value,S3} if c/0 not special v(S) -> {S,S}. But I don't know how much cluttering is removed, if any, for real programs. Works nice for Prolog but for Erlang it may not be as useful, kent From mikpe@REDACTED Tue May 28 00:47:45 2002 From: mikpe@REDACTED (Mikael Pettersson) Date: Tue, 28 May 2002 00:47:45 +0200 (MET DST) Subject: Threads support faulty in R8B-0 and R8B-1? Message-ID: <200205272247.AAA09289@harpo.it.uu.se> On Fri, 17 May 2002 15:55:50 -0400, Shawn Pearce wrote: >I'm having this exact same issue on Debian with 2.4.18. I built >beam with hipe, but have not tried it without hipe. I stuck it on the >back burner, as I could always run the driver I'm developing in a >pthread or an external process. >... >Leonid Timochouk scrawled: >> Hello Erlang users, >> >> I am using Erlang/OTP R8B-0 (and now R8B-1) on Debian Linux with glibc >> 2.2.5, kernel 2.4.18. In both cases, "beam" blocks immediately on start-up >> if invoked with a non-0 number of threads via the "+A" option, does not >> even display the initial "Erlang (BEAM) emulator version ..." message. It >> does create 3 threads, though, and the first of them can be observed with >> a debugger. It has the following call stack (blocked at "sigsuspend"): Here is a patch which should fix this problem. Tested with glibc 2.1.3, 2.1.92, 2.2.2, 2.2.4, and 2.2.5, on various RedHat releases. The problem was in erts/emulator/hipe/hipe_x86_signal.c, the code which enforces the SA_ONSTACK flag in sigaction() calls. This patch should apply both to the current development code and the R8B-1 release. Holler if it doesn't work. /Mikael --- otp-0517/erts/emulator/hipe/hipe_x86_signal.c.~1~ Mon Oct 8 12:25:05 2001 +++ otp-0517/erts/emulator/hipe/hipe_x86_signal.c Mon May 27 22:53:36 2002 @@ -27,38 +27,88 @@ #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 2 /* - * In glibc 2.2 the signal setup functions call __sigaction(), which in - * turn calls __libc_sigaction() [or perhaps there's a weak ref, I dunno]. - * So we just call __libc_sigaction() directly by name. - * Note: The RTLD_NEXT trick does not work. + * __libc_sigaction() is the core routine. + * Without libpthread, sigaction() and __sigaction() are both aliases + * for __libc_sigaction(). + * libpthread redefines __sigaction() as a non-trivial wrapper around + * __libc_sigaction(), and makes sigaction() an alias for __sigaction(). + * glibc has internal calls to both sigaction() and __sigaction(). + * + * Overriding __libc_sigaction() would be ideal, but doing so breaks + * libpthread (threads hang). + * + * Overriding __sigaction(), using dlsym RTLD_NEXT to find glibc's + * version of __sigaction(), works with glibc-2.2.4 and 2.2.5. + * Unfortunately, this solution doesn't work with earlier versions, + * including glibc-2.2.2 and glibc-2.1.92 (2.2 despite its name): + * 2.2.2 SIGSEGVs in dlsym RTLD_NEXT (known glibc bug), and 2.1.92 + * SIGSEGVs inexplicably in two test cases in the HiPE test suite. + * + * Instead we only override sigaction() and call __sigaction() + * directly. This should work for HiPE/x86 as long as only the Posix + * signal interface is used, i.e. there are no calls to simulated + * old BSD or SysV interfaces. + * glibc's internal calls to __sigaction() appear to be mostly safe. + * hipe_signal_init() fixes some unsafe ones, e.g. the SIGPROF handler. + * + * Tested with glibc-2.1.92 on RedHat 7.0, glibc-2.2.2 on RedHat 7.1, + * glibc-2.2.4 on RedHat 7.2, and glibc-2.2.5 on RedHat 7.3. */ -extern int __libc_sigaction(int, const struct sigaction*, struct sigaction*); +#if 0 +/* works with 2.2.5 and 2.2.4, but not 2.2.2 or 2.1.92 */ +#define __USE_GNU /* to un-hide RTLD_NEXT */ +#include +static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); +#define init_done() (__next_sigaction != 0) +#define __SIGACTION __sigaction +static void do_init(void) +{ + __next_sigaction = dlsym(RTLD_NEXT, "__sigaction"); + if( __next_sigaction != 0 ) + return; + perror("dlsym"); + abort(); +} +#define INIT() do { if( !init_done() ) do_init(); } while(0) +#else +/* semi-works with all 2.2 versions so far */ +extern int __sigaction(int, const struct sigaction*, struct sigaction*); +#define __next_sigaction __sigaction /* pthreads-aware version */ +#undef __SIGACTION /* we can't override __sigaction() */ #define INIT() do{}while(0) #endif +#endif /* glibc 2.2 */ #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 1 /* - * In glibc 2.1 the signal setup functions call __sigaction() but there - * is no further function behind it. So we use dlsym(RTLD_NEXT) to obtain - * __sigaction()'s address, and call it indirectly. - * XXX: May also work with glibc 2.0, but I can't test this. + * __sigaction() is the core routine. + * Without libpthread, sigaction() is an alias for __sigaction(). + * libpthread redefines sigaction() as a non-trivial wrapper around + * __sigaction(). + * glibc has internal calls to both sigaction() and __sigaction(). * - * When linked with thread support, there are calls to sigaction() before - * our init routine has had a chance to find __sigaction()'s address. - * This forces us to initialise at the first call. + * Overriding __sigaction() would be ideal, but doing so breaks + * libpthread (threads hang). Instead we override sigaction() and + * use dlsym RTLD_NEXT to find glibc's version of sigaction(). + * glibc's internal calls to __sigaction() appear to be mostly safe. + * hipe_signal_init() fixes some unsafe ones, e.g. the SIGPROF handler. + * + * Tested with glibc-2.1.3 on RedHat 6.2. */ #include -static int (*__libc_sigaction)(int, const struct sigaction*, struct sigaction*); -#define init_done() (__libc_sigaction != 0) +static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); +#define init_done() (__next_sigaction != 0) +#undef __SIGACTION static void do_init(void) { - if( (__libc_sigaction = dlsym(RTLD_NEXT, "__sigaction")) != 0 ) + __next_sigaction = dlsym(RTLD_NEXT, "sigaction"); + if( __next_sigaction != 0 ) return; perror("dlsym"); abort(); } #define INIT() do { if( !init_done() ) do_init(); } while(0) -#endif +#endif /* glibc 2.1 */ #if !defined(__GLIBC__) /* @@ -81,25 +131,26 @@ * This forces us to initialise at the first call. */ #include -static int (*__libc_sigaction)(int, const struct sigaction*, struct sigaction*); -#define init_done() (__libc_sigaction != 0) +static int (*__next_sigaction)(int, const struct sigaction*, struct sigaction*); +#define init_done() (__next_sigaction != 0) +#define __SIGACTION _sigaction static void do_init(void) { - if( (__libc_sigaction = dlsym(RTLD_NEXT, "_sigaction")) != 0 ) + __next_sigaction = dlsym(RTLD_NEXT, "_sigaction"); + if( __next_sigaction != 0 ) return; perror("dlsym"); abort(); } -#define __sigaction _sigaction #define _NSIG NSIG #define INIT() do { if( !init_done() ) do_init(); } while(0) -#endif +#endif /* not glibc */ /* * This is our wrapper for sigaction(). sigaction() can be called before * hipe_signal_init() has been executed, especially when threads support * has been linked with the executable. Therefore, we must initialise - * __libc_sigaction() dynamically, the first time it's needed. + * __next_sigaction() dynamically, the first time it's needed. */ static int my_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) { @@ -115,17 +166,19 @@ newact.sa_flags |= SA_ONSTACK; act = &newact; } - return __libc_sigaction(signum, act, oldact); + return __next_sigaction(signum, act, oldact); } /* * This overrides the C library's core sigaction() procedure, catching * all its internal calls. */ -int __sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) +#ifdef __SIGACTION +int __SIGACTION(int signum, const struct sigaction *act, struct sigaction *oldact) { return my_sigaction(signum, act, oldact); } +#endif /* * This catches the application's own sigaction() calls. From vances@REDACTED Tue May 28 01:03:33 2002 From: vances@REDACTED (Vance Shipley) Date: Mon, 27 May 2002 19:03:33 -0400 Subject: variable '_' is unbound Message-ID: <20020527230333.GF33944@frogman.motivity.ca> What is wrong with this: foo(Arg) when bar == Arg; <<_:16>> == Arg -> ok. When I try to compile it I get: 1> c(t). ./t.erl:4: variable '_' is unbound error This is using R8B-1. -Vance From lennart.ohman@REDACTED Tue May 28 08:36:08 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Tue, 28 May 2002 08:36:08 +0200 Subject: variable '_' is unbound References: <20020527230333.GF33944@frogman.motivity.ca> Message-ID: <3CF32558.E1F2599D@st.se> Hi, the compiler complains because you are trying to use == for matching. In a test, both sides must be bound. /Lennart Vance Shipley wrote: > > What is wrong with this: > > foo(Arg) when bar == Arg; <<_:16>> == Arg -> ok. > > When I try to compile it I get: > > 1> c(t). > ./t.erl:4: variable '_' is unbound > error > > This is using R8B-1. > > -Vance ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28, STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From raimo@REDACTED Tue May 28 08:49:09 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Tue, 28 May 2002 08:49:09 +0200 Subject: variable '_' is unbound References: <20020527230333.GF33944@frogman.motivity.ca> Message-ID: <3CF32865.D0AD9D48@erix.ericsson.se> You can only have bound variables in a guard, and you can only bind variables in the argument list of a function definition. (First hunch). foo(Arg) when bar == Arg -> ok; foo(<<_:16>> == Arg) -> ok. or foo(Arg) when bar == Arg; binary(Arg), size(Arg) == 2 -> ok. or something. / Raimo Niskanen, Erlang/OTP, Ericsson AB Vance Shipley wrote: > > What is wrong with this: > > foo(Arg) when bar == Arg; <<_:16>> == Arg -> ok. > > When I try to compile it I get: > > 1> c(t). > ./t.erl:4: variable '_' is unbound > error > > This is using R8B-1. > > -Vance From raimo@REDACTED Tue May 28 09:08:20 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Tue, 28 May 2002 09:08:20 +0200 Subject: How to compare two lists? References: <3CF24AAE.81C2F06A@cbe.ericsson.se> Message-ID: <3CF32CE4.C7DCC305@erix.ericsson.se> According to the Erlang Book (Concurrent Programming in Erlang), , chapter 2.5.6, comparision is done as follows:
The comparison operators work as follows: fi rstly, both sides of the operator are evaluated where possible (i.e. in the case when they are arithmetic expressions, or contain guard function BIFs); then the comparison operator is performed. For the purposes of comparison the following ordering is defi ned: number < atom < reference < port < pid < tuple < list Tuples are ordered fi rst by their size then by their elements. Lists are ordered by comparing heads, then tails.
According to that last paragraph, lists are indeed traversed by the '==' operator, so you should be able to write: my_func(List1, List2) -> if List1 == List2 -> true; true -> false; end. or even without the '==' operator: my_func(L, L) -> true; my_func(_, _) -> false. or why do you need my_func/2 , it just does: List1 == List2 / Raimo Niskanen, Erlang/OTP, Ericsson AB Dariab Wahed wrote: > > Hi! > Can you help me, > > How to compare two lists? > eg. > > my_func(List1,List2) > if > List1 == List2 -> ok; > List1/= List2 -> {error,"error!!!!"}; > end. From joe@REDACTED Tue May 28 09:54:11 2002 From: joe@REDACTED (Joe Armstrong) Date: Tue, 28 May 2002 09:54:11 +0200 (CEST) Subject: forget In-Reply-To: Message-ID: > > I don't know if I misunderstand what you mean but one idea I have had > is to use something similar to Prolog DCG (definite clause grammar) > syntax so that the code can be written hiding the extra parameter > passed around to every call. For example something like > > foo() --> > bar(), % Call to other --> functions that return > X = baz(), % implicitly return {AnyValue,HiddenVar} > Val = v(), % Special call v() returns hidden parameter > % at the point of the call. > c(Value = zab(Val,X)), % Not a --> call, normal function call > Value. > > could be expanded by the preprocessor to > > foo(S0) -> > {_,S1} = bar(S0), > {X,S2} = baz(S1), > Val = S2, % or a call {Val,S3} = v(S2) if not special > Value = zab(Val,X), > {Value,S2}. % or {Value,S3} if c/0 not special > > v(S) -> {S,S}. > > But I don't know how much cluttering is removed, if any, for real > programs. Works nice for Prolog but for Erlang it may not be as > useful, Umm - and then we can say "Erlang has got Monads!" /Joe > > kent > From jamesh@REDACTED Tue May 28 18:05:43 2002 From: jamesh@REDACTED (James Hague) Date: Tue, 28 May 2002 11:05:43 -0500 Subject: forget Message-ID: > Umm - and then we can say "Erlang has got Monads!" Heh. That was my first thought. Or, as much as I hate to suggest it, Perl's pronouns take care of this as well. Let's say that the caret (^) means "value returned by the preceding expression in a comma delineated sequence": foo(Value) -> bar(Value), baz(^), zab(^), {ok, ^). It's sort of a visual pointer to the preceding line. From cpressey@REDACTED Tue May 28 19:06:11 2002 From: cpressey@REDACTED (Chris Pressey) Date: Tue, 28 May 2002 12:06:11 -0500 Subject: forget In-Reply-To: References: Message-ID: <20020528120611.19dd2126.cpressey@catseye.mb.ca> On Tue, 28 May 2002 09:54:11 +0200 (CEST) Joe Armstrong wrote: > > > > I don't know if I misunderstand what you mean but one idea I have had > > is to use something similar to Prolog DCG (definite clause grammar) > > syntax so that the code can be written hiding the extra parameter > > passed around to every call. For example something like > > > > foo() --> > > bar(), % Call to other --> functions that > > return X = baz(), % implicitly return > > {AnyValue,HiddenVar} Val = v(), % Special call > > v() returns hidden parameter > > % at the point of the call. > > c(Value = zab(Val,X)), % Not a --> call, normal function > > call Value. > > > > could be expanded by the preprocessor to > > > > foo(S0) -> > > {_,S1} = bar(S0), > > {X,S2} = baz(S1), > > Val = S2, % or a call {Val,S3} = v(S2) if not > > special Value = zab(Val,X), > > {Value,S2}. % or {Value,S3} if c/0 not special > > > > v(S) -> {S,S}. > > > > But I don't know how much cluttering is removed, if any, for real > > programs. Works nice for Prolog but for Erlang it may not be as > > useful, > > Umm - and then we can say "Erlang has got Monads!" And then we'll have to stop saying "Erlang is a single assignment language" (since, technically, we're making multiple assignments to an 'invisible' variable.) If we shall go this route, I suggest taking some unused special symbol and calling it the 'default variable', which is always just an 'alias' for the result of the previous evaluation. This could be handy in the shell as well, as a sort of accumulator for an adding machine: 1> 15. 15 2> _+20. 35 3> _+7. 42 Except, obviously, we can't use the underscore, since it already has a meaning. I can't think of a nice symbol off the top of my head that isn't already used (period/full stop would be my next choice, but it's obviously problematic too. Maybe asterisk?) Anyway, it would allow the original example to be rewritten like: foo(Value) -> bar(Value), baz(*), zab(*), {ok, *}. Which is, to me, clearer than the DCG approach. No sneaky claiming this is single-assignment, anymore, though :) -Chris From vances@REDACTED Tue May 28 18:54:32 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 28 May 2002 12:54:32 -0400 Subject: variable '_' is unbound In-Reply-To: <3CF32558.E1F2599D@st.se> References: <20020527230333.GF33944@frogman.motivity.ca> <3CF32558.E1F2599D@st.se> Message-ID: <20020528165432.GH33944@frogman.motivity.ca> On Tue, May 28, 2002 at 08:36:08AM +0200, Lennart ?hman wrote: > > the compiler complains because you are trying to use == > for matching. In a test, both sides must be bound. I's like to be able to cover both cases inn the same clause. Other wise I'm just making two copies of a large chunk of code which is both wasteful and error prone. What I really have is: foo(bar) -> ... foo(<<_:3, 1:1, _:12>>) -> ... So I tried: foo(Arg) when bar == Arg; <<_:3, 1:1, _:12>> == Arg -> I reallu just need to test one bit in the middle of this binary. I guess I need a strategy that doesn't require binding a variable. -Vance From vances@REDACTED Tue May 28 19:28:08 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 28 May 2002 13:28:08 -0400 Subject: variable '_' is unbound In-Reply-To: <20020528165432.GH33944@frogman.motivity.ca> References: <20020527230333.GF33944@frogman.motivity.ca> <3CF32558.E1F2599D@st.se> <20020528165432.GH33944@frogman.motivity.ca> Message-ID: <20020528172808.GI33944@frogman.motivity.ca> On Tue, May 28, 2002 at 12:54:32PM -0400, Vance Shipley wrote: > > foo(Arg) when bar == Arg; <<_:3, 1:1, _:12>> == Arg -> > > > I reallu just need to test one bit in the middle of this binary. > I guess I need a strategy that doesn't require binding a variable. And that strategy seems to be: foo(Arg) when bar == Arg; (is_binary(Arg) and ((Arg band <<16, 0>>) == <<16,0>>)) -> :) -Vance From fredrik.linder@REDACTED Tue May 28 19:48:42 2002 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Tue, 28 May 2002 19:48:42 +0200 Subject: variable '_' is unbound References: <20020527230333.GF33944@frogman.motivity.ca> <3CF32558.E1F2599D@st.se> <20020528165432.GH33944@frogman.motivity.ca> Message-ID: <00dc01c2066f$e81c4ae0$d7b7f2d5@frelin> > I's like to be able to cover both cases inn the same clause. Then why not extract the code in the function clause into a new function, and keep the two clauses in foo? foo(bar) -> extracted_foo_clause(); foo(<< _ : 3, 1 : 1, _:12 >>) -> extracted_foo_clause(). extracted_foo_clause() -> ... % Same ... as below ;-) In this way you both solve your two-clauses-that-cannot-be-written-as-one problem and you'll get a shorter foo/1 function, which is good. :-) But do come up with a better name! /Fredrik > Other wise I'm just making two copies of a large chunk of > code which is both wasteful and error prone. > > What I really have is: > > foo(bar) -> > ... > foo(<<_:3, 1:1, _:12>>) -> > ... > > So I tried: > > foo(Arg) when bar == Arg; <<_:3, 1:1, _:12>> == Arg -> > > > I reallu just need to test one bit in the middle of this binary. > I guess I need a strategy that doesn't require binding a variable. > > -Vance > From jamesh@REDACTED Tue May 28 21:59:50 2002 From: jamesh@REDACTED (James Hague) Date: Tue, 28 May 2002 14:59:50 -0500 Subject: forget Message-ID: >And then we'll have to stop saying "Erlang is a single assignment >language" (since, technically, we're making multiple assignments to an >'invisible' variable.) I don't think that's the case at all. The following two are equivalent: Value = a(b(c())). Value = c(), b(^) a(^). There's no assignment in the evaluation of the right hand side of the expression. It's just that the "top of the stack," so to speak, is being carried along. The preprocessor could convert the latter into the former without using intermediate variables. In Forth this would be: c b a Value ! which I have to admit is prettier. From vances@REDACTED Wed May 29 02:48:24 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 28 May 2002 20:48:24 -0400 Subject: variable '_' is unbound In-Reply-To: <20020528172808.GI33944@frogman.motivity.ca> References: <20020527230333.GF33944@frogman.motivity.ca> <3CF32558.E1F2599D@st.se> <20020528165432.GH33944@frogman.motivity.ca> <20020528172808.GI33944@frogman.motivity.ca> Message-ID: <20020529004824.GE41087@frogman.motivity.ca> > foo(Arg) when bar == Arg; > (is_binary(Arg) and ((Arg band <<16, 0>>) == <<16,0>>)) -> Ahhh, no. I guess I'll have to live with: foo(<<_:3, 1:1, _:12>>) -> foo(bar); foo(bar) -> ... -Vance From cpressey@REDACTED Wed May 29 08:53:36 2002 From: cpressey@REDACTED (Chris Pressey) Date: Wed, 29 May 2002 01:53:36 -0500 Subject: forget In-Reply-To: References: Message-ID: <20020529015336.67f56710.cpressey@catseye.mb.ca> On Tue, 28 May 2002 14:59:50 -0500 James Hague wrote: > >And then we'll have to stop saying "Erlang is a single assignment > >language" (since, technically, we're making multiple assignments to an > >'invisible' variable.) > > I don't think that's the case at all. The following two are equivalent: > > Value = a(b(c())). > > Value = > c(), > b(^) > a(^). > > There's no assignment in the evaluation of the right hand side of the > expression. It's just that the "top of the stack," so to speak, is > being carried along. The preprocessor could convert the latter into the > former without using intermediate variables. A preprocessor could convert anything to anything. That's beside the point. From the point of view of the Erlang programmer, there is no stack nor any intermediate variables -- these are things only implementers should really have to think in terms of. Erlang programmers should be concerned with the language as it's presented. Just because your two examples are equivalent, does not mean they are not different -- ^ is a new kind of identifier. In a single-assignment language, by definition, each identifier takes on one and only one binding during each function invokation, and this binding does not change during the duration of the function invokation. By introducing an identifier ^ which takes on multiple bindings during a single function invokation, we violate this principle, even though we do not have to explicitly say "^ = ..." to make it occur. That's not to say that I'm against it, though. Just that I think it would be more accurate to describe the language as 'mostly, but not entirely, single-assignment' if it's introduced. -Chris From bjarne@REDACTED Wed May 29 12:27:32 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Wed, 29 May 2002 12:27:32 +0200 Subject: ACM SIGPLAN Erlang Workshop References: <200205211121.g4LBLgU25791@cbe.ericsson.se> Message-ID: <3CF4AD14.5910EC92@erix.ericsson.se> Dear Erlang friends, Just a remainder http://www.erlang.se/workshop/2002/ Authors are invited to submit papers or a short summary to Rex Page or to the undersigned by 3rd June, 2002. Best regards Bjarne ------------------------------------ Bjarne D?cker Tekn lic, Tekn dr h c + 46 8 727 5776 bjarne@REDACTED Ericsson AB Box 1505 125 25 ?lvsj? Sweden From hal@REDACTED Wed May 29 13:09:32 2002 From: hal@REDACTED (Hal Snyder) Date: 29 May 2002 06:09:32 -0500 Subject: forget In-Reply-To: <20020528120611.19dd2126.cpressey@catseye.mb.ca> (Chris Pressey's message of "Tue, 28 May 2002 12:06:11 -0500") References: <20020528120611.19dd2126.cpressey@catseye.mb.ca> Message-ID: <87lma39pn7.fsf@gamera.vail> Chris Pressey writes: > And then we'll have to stop saying "Erlang is a single assignment > language" (since, technically, we're making multiple assignments to > an 'invisible' variable.) Right. The feature under discussion sounds like four legs good, two legs better. I'm ok with spending a whole new variable name for each intermediate assignment. They're cheap, and don't have to be single letters. One can even use descriptive names that explain what is going on in the code. From formacion@REDACTED Wed May 29 13:32:38 2002 From: formacion@REDACTED (DPTO FORMACION) Date: Wed, 29 May 2002 13:32:38 +0200 Subject: =?iso-8859-1?Q?CURSOS_Y_MASTER_FORMACI=D3N_INFORMATICA_SERINTER?= Message-ID: <018601c20707$826a5f50$4200a8c0@pablo> Hola , Somos un CENTRO DE FORMACI?N INFORM?TICA, que nos ponemos en contacto con usted para informarle de los cursos que tenemos en nuestro centro. En este caso le comunicamos que tenemos cursos de las siguientes ramas inform?ticas los cuales se encuentran abiertos los plazos de matr?culas: MASTER: PROGRAMACI?N ORIENTADA A INTERNET (QUEDA GARANTIZADO EL PUESTO DE TRABAJO), PROGRAMA OFICIAL PARA LA CERTIFICACI?N JAVA DE SUN (se regala el bono para la realizaci?n del ex?men "Programador Java" oficial de SUN MICROSYSTEM y a la finalizaci?n del curso se obtiene tanto el diploma de SERINTER como el diploma de SUN MICROSYSTEM), REDES, ORACLE, DISE?O PAGINAS WEB, PROGRAMACI?N ORIENTADA A OBJETOS, VISUAL BASIC Y VBA. CURSOS: JAVASCRIPT, ASP, FIREWORKS, DREAMWEAVER, UNIX/ LINUX, FLASH Y ACTIONSCRIPT, OFIM?TICA. Garantizamos BOLSA DE TRABAJO en todos los Master y cursos, con env?o de curr?culums a m?s de 200 empresas colaboradoras. Si est? interesado en alguno de ellos u otros que no hayamos mencionado, o si quiere que le ampliemos informaci?n no dude en contactar con nosotros para hacernos lo saber. Si por el contrario no desea recibir m?s informaci?n nuestra tambi?n h?ganoslo saber para no volver a molestarle. Disculpe las molestias y reciba un cordial saludo. Dpto. Formaci?n SERINTER Doctor Esquerdo, 160 28007 Madrid formaci?n@REDACTED http://www.serinter.com From C.Reinke@REDACTED Wed May 29 18:10:30 2002 From: C.Reinke@REDACTED (C.Reinke) Date: Wed, 29 May 2002 17:10:30 +0100 Subject: forget In-Reply-To: Message from Vance Shipley of "Mon, 27 May 2002 15:28:07 EDT." <20020527192807.GD33944@frogman.motivity.ca> Message-ID: > foo(Value) -> > Value2 = bar(Value), > Value3 = baz(Value2), > Value4 = zab(Value3), > {ok, Value4}. DCGs and other preprocessing have been suggested, but in contrast to Prolog, Erlang is higher order, so why not: do (Value,[]) -> {ok,Value}; do (Value,[F|Fs]) -> V = F(Value), do(V,Fs). foo(Value) -> do (Value,[ fun bar/1, fun baz/1, fun zab/1 ]). A more lightweight syntax for funs would make that a lot nicer, of course, and "do" might not be the most suggestive name, but it avoids names for intermediates as well as language extensions.. Btw, why can't variables be passed unbound to functions (that would make more complex utilities easy)? Claus From robert.virding@REDACTED Wed May 29 23:02:36 2002 From: robert.virding@REDACTED (Robert Virding) Date: Wed, 29 May 2002 23:02:36 +0200 Subject: forget References: Message-ID: <011701c20754$2c102ca0$2100a8c0@virding.org> > >And then we'll have to stop saying "Erlang is a single assignment > >language" (since, technically, we're making multiple assignments to an > >'invisible' variable.) > > I don't think that's the case at all. The following two are equivalent: > > Value = a(b(c())). > > Value = > c(), > b(^) > a(^). > > There's no assignment in the evaluation of the right hand side of the > expression. It's just that the "top of the stack," so to speak, is being > carried along. The preprocessor could convert the latter into the former > without using intermediate variables. In Forth this would be: > > c b a Value ! > > which I have to admit is prettier. There are a couple of problems here. The first one someone has already mentioned, that while Forth has an explicit stack Erlang (the language) doesn't, it has variables. The second one is that I personally find that I seldom have this type of code, it is usually something like: f(A0, B0, C0) -> {A1,B1,C1} = a(A0, B0, C0), {A2,B2,C2} = b(A1, B1, C1), ... . so an ^ would be of very little use. Robert From spearce@REDACTED Thu May 30 05:37:39 2002 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 29 May 2002 23:37:39 -0400 Subject: Lost data when sending to a linked in driver Message-ID: <20020529233739.A246511@spearce.org> I'm using R8B-1 and a custom linked in driver that I'm currently developing. The driver uses the outputv hook to receive binary data sent by the Erlang node. When I'm sending data to the driver, I use erlang:port_call to set the driver into some state, at which point it receives data through the outputv hook (using Port ! {self(), {command, SomeList}}). SomeList is a proper Erlang list of 32 binaries, each 1.5 MB in size. Erts decides to send 1 element in the ErlIOVec which is passed to my driver's outputv hook. This element is the customary 0th "empty" element for the driver to hook in any header data prior to transmission. None of the binaries I sent to the driver from Erlang were presented to the driver. However, if I send a list of only 15 binaries, each 1.5 MB in size they all appear in the ErlIOVec. The driver gets 16 items in the ErlIOVec, with the 15 binaries supplied starting at index 1, as they should. Unfortunately, there seems to be no way for Erlang or the driver to know that Erts dropped the list of binaries on the floor when it exceeds 15 elements. If these binaries were smaller, I'd expect that Erts would compact them into a single binary, but they aren't (and I can't shrink them, its my data's natural chunk size). I also don't really want Erts copying 32 MB of data into a compacted binary here. Zero-copy needs to be the name of the game. :-) So I've come up with this twisted chunk of code for the port driver to send to my linked in driver: % Taken from erts/emulator/beam/io.c: SMALL_WRITE_VEC = 16 % This is how many binaries we can send down. io.c adds one binary on top % of this in case the driver wants to use it to define a packet header. % This header slot is unused, giving us 15 buffers. -define(MAX_IOVEC, 15). post_frames({Port}, FrameList) -> post_frames(Port, FrameList, [], 0). post_frames(_, [], [], 0) -> ok; post_frames(Port, [], Bundle, Cnt) -> Port ! {self(), {command, lists:reverse(Bundle)}}, receive {Port, frames_queued, Count} -> ok end; post_frames(Port, FrameList, Bundle, Cnt) when Cnt == ?MAX_IOVEC -> Port ! {self(), {command, lists:reverse(Bundle)}}, receive {Port, frames_queued, Count} -> post_frames(Port, FrameList, [], 0) end; post_frames(Port, [Frame | List], Bundle, Cnt) -> post_frames(Port, List, [Frame | Bundle], Cnt + 1). This code however, screams out to me as having a few issues. The first is that MAX_IOVEC is set deep down inside of the emulator. There is no way to get this value from Erlang at runtime, or from the driver at compile time or runtime. If SMALL_WRITE_VEC ever changed in the eumulator from 16 to another value, this code could break. The second issue is that when creating the list of frames which can be sent to the driver, I need to compose that list, then reverse it. Would it be better if I wrote the post_frames/4 function more like: post_frames(Port, [F1,F2,F3,F4,F5,F6,F7,F8 | T]) -> Port ! {self(), {command, [F1,F2,F3,F4,F5,F6,F7,F8]}}, receive {Port, frames_queued, Count} -> post_frames(Port, T) end; post_frames(Port, [F1,F2,F3,F4 | T]) -> Port ! {self(), {command, [F1,F2,F3,F4]}}, receive {Port, frames_queued, Count} -> post_frames(Port, T) end; post_frames(Port, [F1,F2 | T]) -> Port ! {self(), {command, [F1,F2]}}, receive {Port, frames_queued, Count} -> post_frames(Port, T) end; post_frames(Port, [F1 | T]) -> Port ! {self(), {command, [F1,F2]}}, receive {Port, frames_queued, Count} -> post_frames(Port, T) end; post_frames(Port, []) -> ok. as this version now does not require creating two lists, and reversing one of them? Unfortunately, it still suffers from the problem that if the value of SMALL_WRITE_VEC ever changed from 16 to smaller than 8 I could run the risk of losing all 8 binaries when they are matched in the first clause. I would really like to be able to send a group of binaries to the driver at once, as the driver is using locking a pthread mutexes directly to interface to some "legacy" pthread code, delivering the group of binaries to that "legacy" pthread (after incremeting ErlDrvBinary.refc. The cost of sending one binary is about the same as sending 8 or 12 binaries at a time, due to the cost of locking and unlocking a pthread mutex, so I'd like to 'batch' them as much as possible, especially since the port driver will be receiving batches of binaries from the rest of the Erlang system. At any rate, no matter how I implement my code, it looks like there might be a bug in io.c when the number of binaries exceeds 15 and their size is too large to compact them. -- Shawn. Why do I like Erlang? Because ``it'll drop your data for you, without asking you.'' (See above email. :-) Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From hongwei.chen@REDACTED Thu May 30 08:12:44 2002 From: hongwei.chen@REDACTED (Daniel Chen Hongwei) Date: Thu, 30 May 2002 14:12:44 +0800 Subject: Question on SNMP agent In-Reply-To: Message-ID: Hi, We're thinking about the access limitation for certain SNMP agent based on OTP. The <> states that we can configure the IP address for the manager ( "IP address for the manager (only this manager will have access to the agent, traps are sent to this one) [dront.ericsson.se]"). Does that means only the configured manager have authority to GET or SET the data from this agent or just means that the agent will only send TRAP to the configured manager? Thanks a lot! /Daniel From jamesh@REDACTED Thu May 30 17:05:42 2002 From: jamesh@REDACTED (James Hague) Date: Thu, 30 May 2002 10:05:42 -0500 Subject: forget Message-ID: >There are a couple of problems here. The first one someone has already >mentioned, that while Forth has an explicit stack Erlang (the language) >doesn't, it has variables. The second one is that I personally find that >I seldom have this type of code, I agree, in that the last thing Erlang needs is another fringe feature. The "language extensions since 4.4" section of the documentation is becoming daunting. But I do see this sort of "VarN =" code regularly, even in OTP itself, and it always makes me think that there has to be a better way. From Sean.Hinde@REDACTED Thu May 30 17:34:21 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Thu, 30 May 2002 16:34:21 +0100 Subject: SSL clients Message-ID: <04D356A3B172D611981B0008C791C3126BF077@imp02mbx.t-mobile.co.uk> Hi, I'm have a bit of trouble getting ssl:connect/3 to work. I don't have a officially CA'd set of certificates but I've tried with self generated ones, the ones included with openssl, the ones included with inets, and the ones included with yaws.. I get as far as failing with {error, eselfsignedcert}. Connecting with Netscape is fine - I agree to accept the certificate offered and I'm in - ssl:connect/3 appears to offer the {verify,N} option which should allow me to replicate this sort of behaviour but regardless of what I set this to, I always get thrown out. Has anyone managed to get this to work? Any useful hints are most welcome. Thanks, Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From apeake@REDACTED Thu May 30 18:26:41 2002 From: apeake@REDACTED (Alex Peake) Date: Thu, 30 May 2002 09:26:41 -0700 Subject: forget In-Reply-To: Message-ID: Forgive my lack of Erlang knowledge, but this all seems like a standard pattern of "Composition"? %%%% Compose functions compose([Fn]) -> Fn; compose([Fn | FnTail]) -> fun(Args) -> apply(Fn,[apply(compose(FnTail),[Args])]) end. Alex > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of James Hague > Sent: Thursday, May 30, 2002 8:06 AM > To: 'erlang-questions@REDACTED' > Subject: Re: forget > > > >There are a couple of problems here. The first one someone has already > >mentioned, that while Forth has an explicit stack Erlang (the language) > >doesn't, it has variables. The second one is that I personally find that > >I seldom have this type of code, > > I agree, in that the last thing Erlang needs is another fringe > feature. The > "language extensions since 4.4" section of the documentation is becoming > daunting. But I do see this sort of "VarN =" code regularly, even in OTP > itself, and it always makes me think that there has to be a better way. > From etxuwig@REDACTED Thu May 30 20:10:17 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 30 May 2002 20:10:17 +0200 (MET DST) Subject: forget In-Reply-To: Message-ID: On Thu, 30 May 2002, Alex Peake wrote: >Forgive my lack of Erlang knowledge, but this all seems like a >standard pattern of "Composition"? > >%%%% Compose functions >compose([Fn]) -> > Fn; >compose([Fn | FnTail]) -> > fun(Args) -> > apply(Fn,[apply(compose(FnTail),[Args])]) > end. > >Alex That is certainly a pretty common pattern, but I don't think it suffices to solve the problem that James refers to (and I have complained about in previous postings.) Just to take an example (perhaps not the best one, but rather one that I could find in about 10 seconds): scan_xml_decl("encoding" ++ T, S0 = #xmerl_scanner{event_fun = Event}, Decl0 = #xmlDecl{attributes = Attrs}) -> %% [80] EncodingDecl ?bump_col(8), {T1, S1} = scan_eq(T, S), {EncName, T2, S2} = scan_enc_name(T1, S1), Attr = #xmlAttribute{name = encoding, parents = [{xml, XMLPos = 1}], value = EncName}, Decl = Decl0#xmlDecl{encoding = EncName, attributes = [Attr|Attrs]}, S3 = #xmerl_scanner{} = Event(#xmerl_event{event = ended, line = S0#xmerl_scanner.line, col = S0#xmerl_scanner.col, data = Attr}, S2), scan_xml_decl(T2, S3, Decl). This function, I think, reflects the nasty problems you can get into with this style of programming. There are other functions in the same module with greater complexity of numbered variables. The suggestions so far don't offer a solution, as I see it. I don't have one myself, other than (a) throwing it all out and rewriting the code using a different programming model, or (b) trying to live with the problem, carefully tracing by hand all variable use in each funtion. (Oh, if you're wondering where T and S came from, the ?bump_col(8) macro binds them (yes, ouch!)) /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From luke@REDACTED Thu May 30 20:26:09 2002 From: luke@REDACTED (Luke Gorrie) Date: 30 May 2002 20:26:09 +0200 Subject: forget In-Reply-To: References: Message-ID: Ulf Wiger writes: > That is certainly a pretty common pattern, but I don't think it > suffices to solve the problem that James refers to (and I have > complained about in previous postings.) > > Just to take an example (perhaps not the best one, but rather one > that I could find in about 10 seconds): The solution is simply to name the intermediate variables S100, S200, S300, so that you can then insert/delete lines safely without altering the existing flow. What did you learn to program on, anyway? ;-) Cheers, Luke From etxuwig@REDACTED Thu May 30 20:35:26 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 30 May 2002 20:35:26 +0200 (MET DST) Subject: forget In-Reply-To: Message-ID: On 30 May 2002, Luke Gorrie wrote: >The solution is simply to name the intermediate variables S100, >S200, S300, so that you can then insert/delete lines safely >without altering the existing flow. > >What did you learn to program on, anyway? ;-) > >Cheers, >Luke Oh, I spent a lot of time writing code in Omnis 3. It didn't have named variables at all -- only "hash variables": #1 - #60. #1 - #10 were integers, some where floats, and the rest were strings, if I recall correctly. Why? (: /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From vances@REDACTED Thu May 30 20:40:21 2002 From: vances@REDACTED (Vance Shipley) Date: Thu, 30 May 2002 14:40:21 -0400 Subject: forget In-Reply-To: References: Message-ID: <20020530184021.GE89459@frogman.motivity.ca> I still would like to see the linter solution. -Vance On Thu, May 30, 2002 at 08:10:17PM +0200, Ulf Wiger wrote: > ... > The suggestions so far don't offer a solution, as I see it. I > don't have one myself, other than (a) throwing it all out and > rewriting the code using a different programming model, or (b) > trying to live with the problem, carefully tracing by hand all > variable use in each funtion. From matthias@REDACTED Thu May 30 21:15:41 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 30 May 2002 21:15:41 +0200 Subject: forget In-Reply-To: References: Message-ID: <15606.31325.58958.455802@antilipe.corelatus.se> > I agree, in that the last thing Erlang needs is another fringe feature. The > "language extensions since 4.4" section of the documentation is becoming > daunting. But I do see this sort of "VarN =" code regularly, even in OTP > itself, and it always makes me think that there has to be a better way. As Joe alluded, the better way used by at least part of the functional programming world is monads, for instance this article shows how they could be used in Ulf Wiger's XML parser example (among others): http://www.engr.mun.ca/~theo/Misc/haskell_and_monads.htm But the R1, R2, R3 style of programming combined with the +warn_unused_vars flag works reasonably sufficiently well for me that it doesn't seem worth the added complexity (in the manual, among other places!) of monads. Matthias From peter@REDACTED Thu May 30 20:56:06 2002 From: peter@REDACTED (Peter H|gfeldt) Date: Thu, 30 May 2002 20:56:06 +0200 (MET DST) Subject: SSL clients In-Reply-To: <04D356A3B172D611981B0008C791C3126BF077@imp02mbx.t-mobile.co.uk> Message-ID: Having a self-signed certificate at level zero is considered an error in the OTP SSL application. That is rather silly (I did it), for then you could not use SSL as a top CA, for instance. I will record it as a bug to the fixed for R9. I attach the following certificate files so you can easily continue testing. The certificates are not self-signed and are used in the OTP SSL test suites. They do work with verify = 0 (the client does not even need one). file use for option ---- -------------- ssl_server.pem certfile ssl_client.pem certfile I also attach a set of certificate and key files for true verifying. file use for option ---- -------------- allcacert.pem cacertfile servcert.pem certfile servkey.pem keyfile clntcert.pem certfile clntkey.pem keyfile Note however that the option `cacertfile' does not work due to a bug in SSLeay (maybe it works in OpenSSL), so you have to set the OS environment variable SSL_CERT_FILE to "/allcacert.pem". This sad fact is documented in the release notes. For R9 I will abandon SSLeay for OpenSSL, and try to sort out the weaknesses. /Peter ------------------------------------------------------------------------- Peter H?gfeldt e-mail : peter@REDACTED Open Telecom Platform Phone: : +46 (8) 727 57 58 Ericsson AB Mobile : +46 070-519 57 51 S-126 25 STOCKHOLM Fax: : +46 (8) 727 5775 Office address: Armborstv?gen 1, ?lvsj? "Computers are machines that do exactly what you tell them, but often surprise you in the result." Richard Dawkins in The Blind Watchmaker On Thu, 30 May 2002, Sean Hinde wrote: > Hi, > > I'm have a bit of trouble getting ssl:connect/3 to work. I don't have a > officially CA'd set of certificates but I've tried with self generated ones, > the ones included with openssl, the ones included with inets, and the ones > included with yaws.. > > I get as far as failing with {error, eselfsignedcert}. Connecting with > Netscape is fine - I agree to accept the certificate offered and I'm in - > ssl:connect/3 appears to offer the {verify,N} option which should allow me > to replicate this sort of behaviour but regardless of what I set this to, I > always get thrown out. > > Has anyone managed to get this to work? Any useful hints are most welcome. > > Thanks, > > Sean > > > > NOTICE AND DISCLAIMER: > This email (including attachments) is confidential. If you have received > this email in error please notify the sender immediately and delete this > email from your system without copying or disseminating it or placing any > reliance upon its contents. We cannot accept liability for any breaches of > confidence arising through use of email. Any opinions expressed in this > email (including attachments) are those of the author and do not necessarily > reflect our opinions. We will not accept responsibility for any commitments > made by our employees outside the scope of our business. We do not warrant > the accuracy or completeness of such information. > -------------- next part -------------- A non-text attachment was scrubbed... Name: pem-files.tar.gz Type: application/octet-stream Size: 5451 bytes Desc: URL: From spearce@REDACTED Fri May 31 06:38:28 2002 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 31 May 2002 00:38:28 -0400 Subject: Determining the platform you are running on Message-ID: <20020531003828.A249477@spearce.org> Does anyone have any idea on how to request that Erlang return the platform it is currently running on? I'm looking for some type of string, such as returned by GNU autoconf's config.guess would return, for example "i686-pc-linux-gnu". I would like to use this string to determine the name of the directory to load my linked-in driver(s) from. Or does anyone have a better idea on handling locating my linked in driver shared objects? -- Shawn. Why do I like Perl? Because ``in accordance with Unix tradition Perl gives you enough rope to hang yourself with.'' Why do I dislike Java? Because ``the class ROPE that should contain the method HANG to do the hanging doesn't exist because there is too much 'security' built into the base language.'' From vijay.usarathy@REDACTED Fri May 31 06:41:54 2002 From: vijay.usarathy@REDACTED (Vijay Sarathy Upparapalli) Date: Fri, 31 May 2002 10:11:54 +0530 Subject: Regarding a data repository for ASN1 data. Message-ID: <007801c2085d$7d3c4dc0$993210ac@laxeri105493> Hi, I am working on "asn1ct" and "asn1rt". I have a ASN1 file compiled using "erlc" which resulted in four other files. For instance, if my ASN1 file is myfile.asn-- myfile.erl myfile.beam myfile.hrl myfile.asn1db are generated. Can anyone tell me the inherent details of these generated files. Also I am looking to storing the ASN1 specified data. Putting in a nutshell, I am looking towards realizing a database implementation for ASN1 specified data. Any help on this would be appreciated. Vijay. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Wipro_Disclaimer.txt URL: From etxmacr@REDACTED Fri May 31 08:25:14 2002 From: etxmacr@REDACTED (Mats Cronqvist) Date: Fri, 31 May 2002 08:25:14 +0200 Subject: Determining the platform you are running on In-Reply-To: Your message of "Fri, 31 May 2002 00:38:28 EDT." <20020531003828.A249477@spearce.org> Message-ID: <200205310625.g4V6PEs14990@cbe2077.al.sw.ericsson.se> os:type(). {unix,sunos} > Does anyone have any idea on how to request that Erlang return the platform > it is currently running on? I'm looking for some type of string, such > as returned by GNU autoconf's config.guess would return, for example > "i686-pc-linux-gnu". > > I would like to use this string to determine the name of the directory > to load my linked-in driver(s) from. > > Or does anyone have a better idea on handling locating my linked in > driver shared objects? > > -- > Shawn. > > Why do I like Perl? Because ``in accordance with Unix tradition Perl > gives you enough rope to hang yourself with.'' > > Why do I dislike Java? Because ``the class ROPE that should contain the > method HANG to do the hanging doesn't exist because there is too much > 'security' built into the base language.'' From raimo@REDACTED Fri May 31 09:21:11 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Fri, 31 May 2002 09:21:11 +0200 Subject: Determining the platform you are running on References: <20020531003828.A249477@spearce.org> Message-ID: <3CF72467.DA46E9C1@erix.ericsson.se> I have solved that particular problem by adding tag to erlang:system_info/1. Unfortunately does it only exist in (yet to come) R9. It will be: 6> erlang:system_info(system_architecture). "i686-pc-linux-gnu" For the daring open source user I submit two "diff -c"s and a rewritten utility below. I hope these changes are all it takes. / Raimo Niskanen, Erlang/OTP, Ericsson AB ================= diff: *** erts/emulator/beam/erl_bif_info.c@@/main/release/r9_dev/0 Tue Jan 29 11:21:13 2002 --- erts/emulator/beam/erl_bif_info.c@@/main/release/r9_dev/1 Tue Jan 29 13:51:01 2002 *************** *** 760,766 **** n++; hp = HAlloc(BIF_P, n*2); BIF_RET(buf_to_intlist(&hp, tmp_buf, n, NIL)); ! } #ifdef INSTRUMENT else if (BIF_ARG_1 == am_allocated) { Eterm val; --- 760,773 ---- n++; hp = HAlloc(BIF_P, n*2); BIF_RET(buf_to_intlist(&hp, tmp_buf, n, NIL)); ! } else if (BIF_ARG_1 == am_system_architecture) { ! int n; ! ! sys_strcpy((char*)tmp_buf, ERLANG_ARCHITECTURE); ! n = sys_strlen((char*)tmp_buf); ! hp = HAlloc(BIF_P, n*2); ! BIF_RET(buf_to_intlist(&hp, tmp_buf, n, NIL)); ! } #ifdef INSTRUMENT else if (BIF_ARG_1 == am_allocated) { Eterm val; ================= diff: *** erts/emulator/Makefile.in@@/main/release/r9_dev/1 Thu Nov 15 14:06:50 2001 --- erts/emulator/Makefile.in@@/main/release/r9_dev/2 Tue Jan 29 13:50:55 2002 *************** *** 161,167 **** # version include file $(TARGET)/erl_version.h: ../vsn.mk ! $(PERL) utils/make_version -o $@ $(VSN)$(SERIALNO) # driver table $(TARGET)/driver_tab.c: Makefile.in --- 161,167 ---- # version include file $(TARGET)/erl_version.h: ../vsn.mk ! $(PERL) utils/make_version -o $@ $(VSN)$(SERIALNO) $(TARGET) # driver table $(TARGET)/driver_tab.c: Makefile.in ================= erts/emulator/utils/make_version: #!/usr/bin/env perl # ``The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved via the world wide web at http://www.erlang.org/. # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. # # The Initial Developer of the Original Code is Ericsson Utvecklings AB. # Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings # AB. All Rights Reserved.'' # # $Id$ # use strict; # Create the file erl_version.h # # Usage: # make_version [ -o outputfile ] version architecture # # Output goes to ./erl_version.h (or to "outputfile" if specified) # my $time_str = localtime; my $outputfile = "erl_version.h"; @ARGV or die "No arguments given to 'make_version'"; if ($ARGV[0] eq '-o') { shift; # Remove -o $outputfile = shift; defined $outputfile or die "No output file specified"; } my $version = shift; defined $version or die "No version name specified"; my $architecture = shift; defined $architecture or die "No architecture specified"; $architecture =~ s&^.*[/\\]&&; # Remove directory part if any open(FILE, ">$outputfile") or die "Can't create $outputfile: $!"; print FILE < > Does anyone have any idea on how to request that Erlang return the platform > it is currently running on? I'm looking for some type of string, such > as returned by GNU autoconf's config.guess would return, for example > "i686-pc-linux-gnu". > > I would like to use this string to determine the name of the directory > to load my linked-in driver(s) from. > > Or does anyone have a better idea on handling locating my linked in > driver shared objects? > > -- > Shawn. > > Why do I like Perl? Because ``in accordance with Unix tradition Perl > gives you enough rope to hang yourself with.'' > > Why do I dislike Java? Because ``the class ROPE that should contain the > method HANG to do the hanging doesn't exist because there is too much > 'security' built into the base language.'' From per@REDACTED Fri May 31 10:30:29 2002 From: per@REDACTED (Per Bergqvist) Date: Fri, 31 May 2002 09:30:29 +0100 Subject: Determining the platform you are running on In-Reply-To: <20020531003828.A249477@spearce.org> Message-ID: <200205310730.g4V7UTe08600@hyena.levonline.com> > > Or does anyone have a better idea on handling locating my linked in > driver shared objects? > No, not really. Include copy of config.guess and use it where applicable and handle other platforms (e.g. Win) as special cases. /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From raimo@REDACTED Fri May 31 10:43:46 2002 From: raimo@REDACTED (Raimo Niskanen) Date: Fri, 31 May 2002 10:43:46 +0200 Subject: Lost data when sending to a linked in driver References: <20020529233739.A246511@spearce.org> Message-ID: <3CF737C2.8010F2DD@erix.ericsson.se> Sounds like a bug to me, I will look into it. As a comfort, i guess that SMALL_WRITE_VEC will probably never become less than 16. It is now set to match the least allowed value according to Posix.1g of IOV_MAX in sys/uio.h. / Raimo Niskanen, Erlang/OTP, Ericsson AB Shawn Pearce wrote: > > I'm using R8B-1 and a custom linked in driver that I'm currently developing. > The driver uses the outputv hook to receive binary data sent by the Erlang > node. When I'm sending data to the driver, I use erlang:port_call to set > the driver into some state, at which point it receives data through the > outputv hook (using Port ! {self(), {command, SomeList}}). > > SomeList is a proper Erlang list of 32 binaries, each 1.5 MB in size. > > Erts decides to send 1 element in the ErlIOVec which is passed to my > driver's outputv hook. This element is the customary 0th "empty" > element for the driver to hook in any header data prior to transmission. > None of the binaries I sent to the driver from Erlang were presented to > the driver. > > However, if I send a list of only 15 binaries, each 1.5 MB in size > they all appear in the ErlIOVec. The driver gets 16 items in the > ErlIOVec, with the 15 binaries supplied starting at index 1, as > they should. > > Unfortunately, there seems to be no way for Erlang or the driver to > know that Erts dropped the list of binaries on the floor when it > exceeds 15 elements. If these binaries were smaller, I'd expect > that Erts would compact them into a single binary, but they aren't > (and I can't shrink them, its my data's natural chunk size). > I also don't really want Erts copying 32 MB of data into a compacted > binary here. Zero-copy needs to be the name of the game. :-) > > So I've come up with this twisted chunk of code for the port driver > to send to my linked in driver: > > % Taken from erts/emulator/beam/io.c: SMALL_WRITE_VEC = 16 > % This is how many binaries we can send down. io.c adds one binary on top > % of this in case the driver wants to use it to define a packet header. > % This header slot is unused, giving us 15 buffers. > -define(MAX_IOVEC, 15). > > post_frames({Port}, FrameList) -> > post_frames(Port, FrameList, [], 0). > > post_frames(_, [], [], 0) -> > ok; > post_frames(Port, [], Bundle, Cnt) -> > Port ! {self(), {command, lists:reverse(Bundle)}}, > receive > {Port, frames_queued, Count} -> > ok > end; > post_frames(Port, FrameList, Bundle, Cnt) when Cnt == ?MAX_IOVEC -> > Port ! {self(), {command, lists:reverse(Bundle)}}, > receive > {Port, frames_queued, Count} -> > post_frames(Port, FrameList, [], 0) > end; > post_frames(Port, [Frame | List], Bundle, Cnt) -> > post_frames(Port, List, [Frame | Bundle], Cnt + 1). > > This code however, screams out to me as having a few issues. The first > is that MAX_IOVEC is set deep down inside of the emulator. There is > no way to get this value from Erlang at runtime, or from the driver > at compile time or runtime. If SMALL_WRITE_VEC ever changed in the > eumulator from 16 to another value, this code could break. > > The second issue is that when creating the list of frames which can > be sent to the driver, I need to compose that list, then reverse it. > Would it be better if I wrote the post_frames/4 function more like: > > post_frames(Port, [F1,F2,F3,F4,F5,F6,F7,F8 | T]) -> > Port ! {self(), {command, [F1,F2,F3,F4,F5,F6,F7,F8]}}, > receive > {Port, frames_queued, Count} -> > post_frames(Port, T) > end; > post_frames(Port, [F1,F2,F3,F4 | T]) -> > Port ! {self(), {command, [F1,F2,F3,F4]}}, > receive > {Port, frames_queued, Count} -> > post_frames(Port, T) > end; > post_frames(Port, [F1,F2 | T]) -> > Port ! {self(), {command, [F1,F2]}}, > receive > {Port, frames_queued, Count} -> > post_frames(Port, T) > end; > post_frames(Port, [F1 | T]) -> > Port ! {self(), {command, [F1,F2]}}, > receive > {Port, frames_queued, Count} -> > post_frames(Port, T) > end; > post_frames(Port, []) -> > ok. > > as this version now does not require creating two lists, and reversing one of > them? Unfortunately, it still suffers from the problem that if the value of > SMALL_WRITE_VEC ever changed from 16 to smaller than 8 I could run the risk > of losing all 8 binaries when they are matched in the first clause. > > I would really like to be able to send a group of binaries to the driver > at once, as the driver is using locking a pthread mutexes directly to > interface to some "legacy" pthread code, delivering the group of > binaries to that "legacy" pthread (after incremeting ErlDrvBinary.refc. > > The cost of sending one binary is about the same as sending 8 or 12 binaries > at a time, due to the cost of locking and unlocking a pthread mutex, so I'd > like to 'batch' them as much as possible, especially since the port driver > will be receiving batches of binaries from the rest of the Erlang system. > > At any rate, no matter how I implement my code, it looks like there might > be a bug in io.c when the number of binaries exceeds 15 and their size is > too large to compact them. > > -- > Shawn. > > Why do I like Erlang? Because ``it'll drop your data for you, without > asking you.'' (See above email. :-) > > Why do I like Perl? Because ``in accordance with Unix tradition Perl > gives you enough rope to hang yourself with.'' > > Why do I dislike Java? Because ``the class ROPE that should contain the > method HANG to do the hanging doesn't exist because there is too much > 'security' built into the base language.'' From vances@REDACTED Wed May 29 02:48:24 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 28 May 2002 20:48:24 -0400 Subject: variable '_' is unbound In-Reply-To: <20020528172808.GI33944@frogman.motivity.ca> References: <20020527230333.GF33944@frogman.motivity.ca> <3CF32558.E1F2599D@st.se> <20020528165432.GH33944@frogman.motivity.ca> <20020528172808.GI33944@frogman.motivity.ca> Message-ID: <20020529004824.GE41087@frogman.motivity.ca> > foo(Arg) when bar == Arg; > (is_binary(Arg) and ((Arg band <<16, 0>>) == <<16,0>>)) -> Ahhh, no. I guess I'll have to live with: foo(<<_:3, 1:1, _:12>>) -> foo(bar); foo(bar) -> ... -Vance