From mogorman@REDACTED Fri Jun 1 00:14:26 2007 From: mogorman@REDACTED (Matthew O'Gorman) Date: Thu, 31 May 2007 17:14:26 -0500 Subject: [erlang-questions] erlang-mode emacs tabs vs spaces In-Reply-To: References: <465ECAA0.9090405@ericsson.com> Message-ID: I have provided myself with a simple fix this (add-hook 'erlang-mode-hook '(lambda() (setq indent-tabs-mode nil))) should work in your .emacs will cause erlang.el to not produce such messy output i hope other people adopt it. mog On 5/31/07, Matthew O'Gorman wrote: > There are probably lots of fairly easy ways one could work around > this, I am just suggesting that a mix of tabs and spaces seems silly > at best unless there is some reason I'm unaware of it would be better > to go to the python route and just have it consistent. > > mog > > On 5/31/07, Bengt Kleberg wrote: > > On 2007-05-31 15:07, Matthew O'Gorman wrote: > > ...deleted > > > imagine it would be easiest to convert all to spaces, or to just use > > > tabs. I think it would probably be best to just use spaces, what do > > > yall think? > > > > you could use an erlang pretty printer (i use erl_prettypr in > > syntax_tools) before checking in the code in your . > > > > > > bengt > > -- > > Those were the days... > > EPO guidelines 1978: "If the contribution to the known art resides > > solely in a computer program then the subject matter is not > > patentable in whatever manner it may be presented in the claims." > > _______________________________________________ > > erlang-questions mailing list > > erlang-questions@REDACTED > > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From diginux@REDACTED Fri Jun 1 00:58:14 2007 From: diginux@REDACTED (Jordan Wilberding) Date: Thu, 31 May 2007 17:58:14 -0500 Subject: [erlang-questions] Why can't you have a variable before a string with pattern matching? In-Reply-To: <200705312011.l4VKBORq055425@shell.accesscom.com> References: <465F07CA.2060806@diginux.net> <200705312118.37610.javierparis@udc.es> <200705312011.l4VKBORq055425@shell.accesscom.com> Message-ID: <465F5306.4050001@diginux.net> Darius Bacon wrote: > > Anyway, trying to make ++ > fully general in patterns would open up possibilities like > fcn(A ++ "x" ++ B). > > Darius > _______________________________________________ > That is actually what I was hoping to do. I guess it probably just isn't a good hope to have though in regards to efficiency. But it would make some code look nicer. Thanks! Jordan Wilberding From m5@REDACTED Fri Jun 1 01:13:58 2007 From: m5@REDACTED (Mike McNally) Date: Thu, 31 May 2007 18:13:58 -0500 Subject: [erlang-questions] Why can't you have a variable before a string with pattern matching? In-Reply-To: <465F5306.4050001@diginux.net> References: <465F07CA.2060806@diginux.net> <200705312118.37610.javierparis@udc.es> <200705312011.l4VKBORq055425@shell.accesscom.com> <465F5306.4050001@diginux.net> Message-ID: <20070531231358.GB1470@works.com> > That is actually what I was hoping to do. I guess it probably just isn't > a good hope to have though in regards to efficiency. But it would make > some code look nicer. As a suggestion, sometimes using binary types in such situations can work out very nicely. (Not always of course.) -- [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED From saleyn@REDACTED Fri Jun 1 05:30:40 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Thu, 31 May 2007 22:30:40 -0500 Subject: [erlang-questions] driver asyncronous notifications Message-ID: <465F92E0.2000903@gmail.com> Greetings! I wanted to consult with the list on the following subject. In the past couple of weeks I have been writing an Erlang driver for TibcoRV. This messaging system has a proprietary API with a multi-threaded engine. The engine consists of a producer/consumer pair of threads that dispatch and enqueue messages and also allows to register an event callback triggered on every dequeued message. In order to interface with an Erlang driver, I need in the event callback to convert an RV message to an Erlang term and send it to the emulator's thread via driver_output family of functions. The main problem is that the driver API is mostly suited for three sorts of tasks: a. Detection of activity on some registered file descriptor that triggers ready_{input,output} callbacks in the context of the emulator's thread. b. A short-lived non-blocking request initiated from an Erlang process (in the driver-space called via output*() or call() callback functions) and followed by driver_output call to return result to the Erlang side. c. A long-lived asynchronous request via driver_async() call, executed in the context of a thread from a managed thread-pool with the result returned by the async_ready() callback. None of these three cases are suited for events that don't come on file descriptors, but on callbacks in the context of other threads. Unfortunately those callbacks cannon make direct use of driver_output* non thread-safe functions. One possibility is to create a pipe and register a read-end of the pipe with Erlang's select loop by calling driver_select() function, and use write() call on the other end of the pine from another thread to communicate some activity, so that if would trigger the ready_input() driver's callback in the context of emulator's thread. However this is a very expensive solution which I wouldn't want to use. Also driver_async() call is not very efficient in this case either because when called from ThreadC, it'll execute a given function (that doesn't really need to do anything since ThreadC in the RV's callback function already have done all the work of creating an Erlang term to be sent to the emulator) in the context of a ThreadB from a thread-pool and then return to the emulator's ThreadA that can finally call driver_output(). As you see, there is an unnecessary use of ThreadB in this case that leads to performance loss. For reference, I implemented this approach and got performance of 25,000 msgs/sec at 100% CPU utilization, which is not quite suitable for the application I am building (my C implementation gives over 60,000 msgs/sec). Perhaps I am missing something here. How can I send a message originated from some 3rd party callback function in the context of ThreadC (that is not a part of a thread pool managed by Erlang) to the emulator's ThreadA so that it would become aware of the new event and safely deliver this message to a mailbox of an Erlang process (i.e. call driver_output)? Serge From tomas.doyle@REDACTED Fri Jun 1 10:14:11 2007 From: tomas.doyle@REDACTED (Tomas Doyle (DL/LMI)) Date: Fri, 1 Jun 2007 10:14:11 +0200 Subject: [erlang-questions] SGSN Erlang Message-ID: <08BF2532E3F25B4E9C206C9F64923C4301080E6C@esealmw120.eemea.ericsson.se> > Hi, > > Im currently working on the SGSN R7 platform as a technical trainer. > My question is have any of you been involved with > The erlang development of the SGSN ericsson equipment? > The reason I ask is it is very difficult to come across a list > Of erland commands for the node. Perhaps you can help me or point > Me in the direction of somebody who can? > > Kind Regards > > Tomas Doyle > > E > Tom?s Doyle > Technical Training Consultant > Ericsson Education Ireland > Global Service Delivery Center > LM Ericsson Limited > Registered Office: Adelphi Centre, Dun Laoghaire, Co. Dublin, Ireland. > email: tomas.doyle@REDACTED > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oscar@REDACTED Fri Jun 1 10:43:33 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Fri, 01 Jun 2007 09:43:33 +0100 Subject: [erlang-questions] driver asyncronous notifications In-Reply-To: <465F92E0.2000903@gmail.com> References: <465F92E0.2000903@gmail.com> Message-ID: <465FDC35.8070300@erlang-consulting.com> Serge Aleynikov wrote: > Greetings! > > I wanted to consult with the list on the following subject. In the past > couple of weeks I have been writing an Erlang driver for TibcoRV. This > messaging system has a proprietary API with a multi-threaded engine. > The engine consists of a producer/consumer pair of threads that dispatch > and enqueue messages and also allows to register an event callback > triggered on every dequeued message. > > In order to interface with an Erlang driver, I need in the event > callback to convert an RV message to an Erlang term and send it to the > emulator's thread via driver_output family of functions. The main > problem is that the driver API is mostly suited for three sorts of tasks: > > a. Detection of activity on some registered file descriptor that > triggers ready_{input,output} callbacks in the context of the emulator's > thread. > Could you use a pipe here to notify the emulator of the event? > b. A short-lived non-blocking request initiated from an Erlang process > (in the driver-space called via output*() or call() callback functions) > and followed by driver_output call to return result to the Erlang side. > > c. A long-lived asynchronous request via driver_async() call, executed > in the context of a thread from a managed thread-pool with the result > returned by the async_ready() callback. > This is my impression also... We're lacking a way to react on *any* event, and then send messages to the emulator process. > None of these three cases are suited for events that don't come on file > descriptors, but on callbacks in the context of other threads. > Unfortunately those callbacks cannon make direct use of driver_output* > non thread-safe functions. One possibility is to create a pipe and > register a read-end of the pipe with Erlang's select loop by calling > driver_select() function, and use write() call on the other end of the > pine from another thread to communicate some activity, so that if would > trigger the ready_input() driver's callback in the context of emulator's > thread. However this is a very expensive solution which I wouldn't want > to use. > > Also driver_async() call is not very efficient in this case either > because when called from ThreadC, it'll execute a given function (that > doesn't really need to do anything since ThreadC in the RV's callback > function already have done all the work of creating an Erlang term to be > sent to the emulator) in the context of a ThreadB from a thread-pool and > then return to the emulator's ThreadA that can finally call > driver_output(). As you see, there is an unnecessary use of ThreadB in > this case that leads to performance loss. For reference, I implemented > this approach and got performance of 25,000 msgs/sec at 100% CPU > utilization, which is not quite suitable for the application I am > building (my C implementation gives over 60,000 msgs/sec). > > Perhaps I am missing something here. How can I send a message > originated from some 3rd party callback function in the context of > ThreadC (that is not a part of a thread pool managed by Erlang) to the > emulator's ThreadA so that it would become aware of the new event and > safely deliver this message to a mailbox of an Erlang process (i.e. call > driver_output)? > As I mentioned earlier, maybe you could use a pipe to notify ready_{input, output}? I have however not tried this approach and don't know what penalty you'd get. > Serge > > When I asked about this back in August [1] I got the answer "Future versions of the SMP emulator will probably have new driver APIs to make multi-threaded drivers much easier to write." [2] Don't think this has been implemented yet. [1] http://www.erlang.org/pipermail/erlang-questions/2006-August/022158.html [2] http://www.erlang.org/pipermail/erlang-questions/2006-August/022211.html From Lennart.Ohman@REDACTED Fri Jun 1 10:35:13 2007 From: Lennart.Ohman@REDACTED (=?iso-8859-1?Q?Lennart_=D6hman?=) Date: Fri, 1 Jun 2007 10:35:13 +0200 Subject: [erlang-questions] SGSN Erlang References: <08BF2532E3F25B4E9C206C9F64923C4301080E6C@esealmw120.eemea.ericsson.se> Message-ID: Hi Thomas, you can contact me directly either at this or my Ericsson address and I will help you with SGSN specific questions. Best Regards Lennart ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sj?land & Thyselius Telecom AB cellular: +46-70-552 6735 H?lsingegatan 43, 10 tr fax : +46-8-667 8230 SE-113 31 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED ________________________________ Fr?n: erlang-questions-bounces@REDACTED genom Tomas Doyle (DL/LMI) Skickat: fr 2007-06-01 10:14 Till: erlang-questions@REDACTED ?mne: [erlang-questions] SGSN Erlang Hi, Im currently working on the SGSN R7 platform as a technical trainer. My question is have any of you been involved with The erlang development of the SGSN ericsson equipment? The reason I ask is it is very difficult to come across a list Of erland commands for the node. Perhaps you can help me or point Me in the direction of somebody who can? Kind Regards Tomas Doyle E Tom?s Doyle Technical Training Consultant Ericsson Education Ireland Global Service Delivery Center LM Ericsson Limited Registered Office: Adelphi Centre, Dun Laoghaire, Co. Dublin, Ireland. email: tomas.doyle@REDACTED -------------- next part -------------- An HTML attachment was scrubbed... URL: From casper2000a@REDACTED Fri Jun 1 10:57:15 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 1 Jun 2007 14:27:15 +0530 Subject: [erlang-questions] Ignore duplicate difinitions in header files In-Reply-To: <08BF2532E3F25B4E9C206C9F64923C4301080E6C@esealmw120.eemea.ericsson.se> Message-ID: <20070601085717.A254A19DC2E5@mail.wavenet.lk> Hi, Is there a way to ignore duplicate object definitions (eg. record, define, etc) in different included files (.hrl)? For example, if one definition found in a previous included .hrl file, use that, but ignore any later duplicates find. This is required to prevent when multiple .hrl files define the same variable the exactly the same, but compilation exists with errors. Thanks, - Eranga -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.olgeni@REDACTED Fri Jun 1 10:55:26 2007 From: g.olgeni@REDACTED (Giacomo Olgeni) Date: Fri, 01 Jun 2007 10:55:26 +0200 Subject: [erlang-questions] Dialyzer 1.6.0 anc qlc In-Reply-To: <465C5CDC.6030304@colby.it> References: <465C5CDC.6030304@colby.it> Message-ID: <465FDEFE.7070509@colby.it> Giacomo Olgeni wrote: > Dialyzer from R11B-3 worked fine with the same files. It turned out that I still had some old beam files compiled with R11B-3 in the application paths. Once you rebuild everything under R11B-4, Dialyzer will work just fine. bye, Giacomo From richardc@REDACTED Fri Jun 1 11:21:13 2007 From: richardc@REDACTED (Richard Carlsson) Date: Fri, 01 Jun 2007 11:21:13 +0200 Subject: [erlang-questions] Ignore duplicate difinitions in header files In-Reply-To: <20070601085717.A254A19DC2E5@mail.wavenet.lk> References: <20070601085717.A254A19DC2E5@mail.wavenet.lk> Message-ID: <465FE509.3010705@it.uu.se> Eranga Udesh wrote: > Is there a way to ignore duplicate object definitions (eg. record, > define, etc) in different included files (.hrl)? For example, if one > definition found in a previous included .hrl file, use that, but ignore > any later duplicates find. This is required to prevent when multiple > .hrl files define the same variable the exactly the same, but > compilation exists with errors. -ifndef(foo). -define(foo, ...). -endif. (Assuming you have control over at least one of the source .hrl files.) /Richard From saleyn@REDACTED Fri Jun 1 14:27:27 2007 From: saleyn@REDACTED (Serge Aleynikov) Date: Fri, 01 Jun 2007 07:27:27 -0500 Subject: [erlang-questions] driver asyncronous notifications In-Reply-To: <465FFE39.2020003@erlang-consulting.com> References: <465F92E0.2000903@gmail.com> <465FDC35.8070300@erlang-consulting.com> <46600A35.2070204@gmail.com> <465FFE39.2020003@erlang-consulting.com> Message-ID: <466010AF.3040002@gmail.com> Oscar Hellstr?m wrote: >> >> >> One possibility is to create a pipe and >> >> register a read-end of the pipe with Erlang's select loop by calling >> >> driver_select() function, and use write() call on the other end of >> >> the pine from another thread to communicate some activity, so that if >> >> would trigger the ready_input() driver's callback in the context of >> >> emulator's thread. However this is a very expensive solution which I >> >> wouldn't want to use. >> > > I should really learn to think before I speak as well as read before I > reply... And I should learn to proof-read my own posts before clicking "send" to eliminate apparent spelling typos. ;-) >> The problem here is that pipe is a very expensive way of doing >> inter-thread communications. I implemented this approach and wasn't >> happy with performance (that involved two context switches and an >> expensive select() call for messages communicated to the emulator's >> thread). I wish that there was something much more light-weight to >> notify emulator's thread of an external non I/O related event. > > Have you compared the performance loss to that of a port driver? A port > driver would also have to communicate through a pipe, but the > synchronisation issues should be gone. Also, the emulator should be able > to use kernel polling the fd:s I guess. Well, in this case I haven't. However I intuitively think that performance would be much (5-10 times?) worse in case of a port process because it would have to marshal *all* data through a pipe vs. in a driver case just at most one byte per message on the writing end (by the signaling thread) and reading everything accumulated on the pipe at the reading end (by the emulator thread's ready_input() callback) while passing the actual data using an in-memory data structure guarded by a mutex. Serge From oscar@REDACTED Fri Jun 1 13:08:41 2007 From: oscar@REDACTED (=?ISO-8859-1?Q?Oscar_Hellstr=F6m?=) Date: Fri, 01 Jun 2007 12:08:41 +0100 Subject: [erlang-questions] driver asyncronous notifications In-Reply-To: <46600A35.2070204@gmail.com> References: <465F92E0.2000903@gmail.com> <465FDC35.8070300@erlang-consulting.com> <46600A35.2070204@gmail.com> Message-ID: <465FFE39.2020003@erlang-consulting.com> Serge Aleynikov wrote: > Oscar Hellstr?m wrote: >>> >> Could you use a pipe here to notify the emulator of the event? > > Indeed I described that solution in the previous email as well: > > > >> One possibility is to create a pipe and > >> register a read-end of the pipe with Erlang's select loop by calling > >> driver_select() function, and use write() call on the other end of > >> the pine from another thread to communicate some activity, so that if > >> would trigger the ready_input() driver's callback in the context of > >> emulator's thread. However this is a very expensive solution which I > >> wouldn't want to use. > I should really learn to think before I speak as well as read before I reply... > The problem here is that pipe is a very expensive way of doing > inter-thread communications. I implemented this approach and wasn't > happy with performance (that involved two context switches and an > expensive select() call for messages communicated to the emulator's > thread). I wish that there was something much more light-weight to > notify emulator's thread of an external non I/O related event. Have you compared the performance loss to that of a port driver? A port driver would also have to communicate through a pipe, but the synchronisation issues should be gone. Also, the emulator should be able to use kernel polling the fd:s I guess. Best Regards -- Oscar Hellstr?m, oscar@REDACTED Erlang Training and Consulting http://www.erlang-consulting.com/ From tobbe@REDACTED Fri Jun 1 13:05:26 2007 From: tobbe@REDACTED (tobbe) Date: Fri, 01 Jun 2007 12:05:26 +0100 Subject: [erlang-questions] some language changes References: Message-ID: <20070601110526.90F6D5A200@mail.erlangsystems.com> Why not take a fresh start and cook up a new syntax, i.e ErlangRedux. Initially, the mandatory requirement should be: * make use of the existing (super strong) Beam engine. * the general semantics of Erlang processes should be preserved * hot code loading must still work * the distribution mechanism must also be preserved Apart from this, cook up a nice concise syntax! I guess this could hook into existing Hipe backends in an initial approach, Then some good libraries should be written on top of this, which could be done as a comunity effort. All this could be hosted on a community server (making use of 'git' for decentralized development of course :-) Not sure how hard it would be to implement a new syntax like this, but I'm sure several people on the list could do a good estimation of the efforts involved. Cheers, Tobbe (Ps. btw I cant post via Gmane anylonger, bc of tonights 'service' perhaps ?) _________________________________________________________ Post sent from http://www.trapexit.org From pat.eyler@REDACTED Fri Jun 1 05:33:05 2007 From: pat.eyler@REDACTED (pat eyler) Date: Thu, 31 May 2007 21:33:05 -0600 Subject: [erlang-questions] Provo Erlounge -- June 12th Message-ID: <6fd0654b0705312033n789b6c7dm632d760f02bb028b@mail.gmail.com> We'll be meeting at the Open Source Technology Center on the Novell Campus in Provo from 7-9 on tuesday, June 12th. We were each going to put together a distributed program so that we could host a 'show and tell'. It turns out that I have a conflict for that night, so Devlin Daley will be taking charge. -- thanks, -pate ------------------------- Duty makes us do things, Love make us do things well. http://on-ruby.blogspot.com http://on-erlang.blogspot.com http://on-soccer.blogspot.com From heinrich@REDACTED Fri Jun 1 15:32:57 2007 From: heinrich@REDACTED (Heinrich Venter) Date: Fri, 1 Jun 2007 15:32:57 +0200 Subject: [erlang-questions] process_info message_queue_len Message-ID: <002901c7a451$613618f0$23a24ad0$@com> Hi All I want to know which of the processes in my system is taking long to handle messages. I tried to use erlang:process_info(PID) to get the message_queue_len. The problem is that it always returns 0. As an example, I built the following function to test it. F=fun() -> receive xx -> io:format("done~n") end end. P=spawn(F). P!abc erlang:process_info(P). This gives me a message_queue_len of 0. Am I missing something? Maybe message_queue_len measures something other than the number of messages in the mailbox for a process? Any help would be appreciated. Thanks -]-[ -------------- next part -------------- An HTML attachment was scrubbed... URL: From kosik@REDACTED Fri Jun 1 16:07:41 2007 From: kosik@REDACTED (Matej Kosik) Date: Fri, 01 Jun 2007 16:07:41 +0200 Subject: [erlang-questions] is there something like #line In-Reply-To: References: <46598E76.6080008@fiit.stuba.sk> Message-ID: <4660282D.3090205@fiit.stuba.sk> Bjorn Gustavsson wrote: > Use > > -file(Filename, Line). > > Example from erl_parse.erl: > > -file("erl_parse.yrl", 418). Thank you to all. This directive is useful. However, slight problem with Erlang is, that directives cannot be inserted at any place (for example between two clauses of the same function). Although normally it is desirable to have all function clauses in the same "web chunk", in case of -handle_call -handle_info -handle_cast I often wanted to deal with each such clause separately (put it in a separate "chunk"). I am new to Erlang, so I do not see the whole picture, but I did not understand the reason why - every but last function clause must be ended by ; (semicolon) - the last function clause must be ended by . (full stop) - Why not simply require only full stops. - Why must all function clauses belonging to the same function must kept together (this makes sense with normal function but with things like `handle_call', and `handle_cast' it is restricting) This makes Erlang WEB-unfriednly. I have solved the original problem with a small hacky script that translates thinks like ping.erl:12: syntax error before: '-' ping.erl:6: function start_link/0 undefined to ping.nw:79: syntax error before: '-' ping.nw:196: function start_link/0 undefined (semireliable). It is not a good solution but works most of the time. > > /Bjorn > > Matej Kosik writes: > >> * PGP Signed: 05/27/2007 at 03:58:14 PM >> Hello, >> >> Some languages provide mechanisms for "redefining" the current filename and line number. This is done via #line directive. It is not very useful if one writes the code in Erlang, but it is useful when the Erlang code is generated from some other file. For example from a noweb file. I can tangle the actual code so that before each code chunk will be placed correct >> >> # line >> >> command. This way it is possible to influence the compiler error messages and warnings so that they refer to the original file (and line number) rather than to the line number in the generated file. >> >> Is there a similar directive in Erlang? I have tried to google it out, but with little luck. In `Erlang Reference Manual', section 7.2 there I see two interesting macros: >> >> ?FILE. >> The file name of the current module. >> ?LINE. >> The current line number. >> >> Unfortunatelly, when I tried to redefine it, the compiler rejected such redefinitions. Any hint is appreciated. >> >> PS: I am still not 100% sure that using noweb with Erlang is a good idea. But I have used noweb elsewhere (with C and with Pict) so in my current interesting Erlang-task I decided to try it too. >> >> Regards >> -- >> Matej Kosik >> >> * Matej Kosik >> * 0xF248FE18 (L) >> >> _______________________________________________ >> erlang-questions mailing list >> erlang-questions@REDACTED >> http://www.erlang.org/mailman/listinfo/erlang-questions > Regards -- Matej Kosik -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 252 bytes Desc: OpenPGP digital signature URL: From hans.bolinder@REDACTED Fri Jun 1 16:23:44 2007 From: hans.bolinder@REDACTED (Hans Bolinder) Date: Fri, 1 Jun 2007 16:23:44 +0200 Subject: [erlang-questions] process_info message_queue_len In-Reply-To: <002901c7a451$613618f0$23a24ad0$@com> References: <002901c7a451$613618f0$23a24ad0$@com> Message-ID: <18016.11248.770391.89011@gargle.gargle.HOWL> [Heinrich Venter:] > I want to know which of the processes in my system is taking long to handle > messages. I tried to use erlang:process_info(PID) to get the > message_queue_len. The problem is that it always returns 0. > > As an example, I built the following function to test it. > > F=fun() -> receive xx -> io:format("done~n") end end. > P=spawn(F). > P!abc > erlang:process_info(P). > > This gives me a message_queue_len of 0. Am I missing something? The example works fine if the code is compiled, but in the Erlang shell it does not give the expected result. This is due to the way the shell (or rather: erl_eval) evaluates 'receive': the messages are removed from the message queue and kept in a list until some receive clause matches. Best regards Hans Bolinder, Erlang/OTP team From mogorman@REDACTED Fri Jun 1 16:35:30 2007 From: mogorman@REDACTED (Matthew O'Gorman) Date: Fri, 1 Jun 2007 09:35:30 -0500 Subject: [erlang-questions] erlang-mode emacs tabs vs spaces In-Reply-To: <20070601142818.GA6680@frogman.motivity.ca> References: <465ECAA0.9090405@ericsson.com> <20070601142818.GA6680@frogman.motivity.ca> Message-ID: I am an emacs user, I just work with vim users as well and think it is very silly to be so utterly inconsistent. The fix, the line i proposed or others should be trivial to add to the erlang-mode. But seeing as how no one wants to fix the other issues, electric return key etc. I doubt anyone will fix this one, I just thought it should be brought up. mog On 6/1/07, Vance Shipley wrote: > Matthew, > > It is truly a mess however you just need to live with it. > The emacs vs. vi arguments quickly turn religious and no > one wants to start such a flamefest here. It is also not > reasonable to suggest that the OTP team commit a change to > nearly every linbe of source code just to satisfy us vim > users. Emacs is the official IDE for Erlang/OTP. > > -Vance > > From casper2000a@REDACTED Fri Jun 1 14:30:57 2007 From: casper2000a@REDACTED (Eranga Udesh) Date: Fri, 1 Jun 2007 18:00:57 +0530 Subject: [erlang-questions] Ignore duplicate difinitions in header files In-Reply-To: <465FE509.3010705@it.uu.se> Message-ID: <20070601123150.AAA1219DC337@mail.wavenet.lk> Thanks, but sorry I couldn't mention "something other than using -ifndef". Something like using a compiler argument, etc? Some sources are generated by ASN.1 or Yacc, etc. in compile time, I try to void editing them manually. Thanks, - Eranga -----Original Message----- From: Richard Carlsson [mailto:richardc@REDACTED] Sent: Friday, June 01, 2007 2:51 PM To: Eranga Udesh Cc: erlang-questions@REDACTED Subject: Re: [erlang-questions] Ignore duplicate difinitions in header files Eranga Udesh wrote: > Is there a way to ignore duplicate object definitions (eg. record, > define, etc) in different included files (.hrl)? For example, if one > definition found in a previous included .hrl file, use that, but ignore > any later duplicates find. This is required to prevent when multiple > .hrl files define the same variable the exactly the same, but > compilation exists with errors. -ifndef(foo). -define(foo, ...). -endif. (Assuming you have control over at least one of the source .hrl files.) /Richard From Martin.Logan@REDACTED Sat Jun 2 00:02:06 2007 From: Martin.Logan@REDACTED (Logan, Martin) Date: Fri, 1 Jun 2007 17:02:06 -0500 Subject: [erlang-questions] Determine architecture - the erlang way?? Message-ID: Does anyone have a library or a good solid method to determine the hardware architecture of a system written in Erlang? Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From Martin.Logan@REDACTED Sat Jun 2 00:40:29 2007 From: Martin.Logan@REDACTED (Logan, Martin) Date: Fri, 1 Jun 2007 17:40:29 -0500 Subject: [erlang-questions] Determine architecture - the erlang way?? In-Reply-To: References: Message-ID: Let me rephrase my ambiguous request and elaborate. I am looking for a library written in Erlang that will allow me to determine the architecture of a system in such a way as to ensure that C code previously compiled for that architecture class will run on it. Cheers, Martin ________________________________ From: erlang-questions-bounces@REDACTED [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Logan, Martin Sent: Friday, June 01, 2007 5:02 PM To: erlang-questions@REDACTED Subject: [erlang-questions] Determine architecture - the erlang way?? Does anyone have a library or a good solid method to determine the hardware architecture of a system written in Erlang? Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From emad@REDACTED Sat Jun 2 01:29:41 2007 From: emad@REDACTED (Emad El-Haraty) Date: Sat, 2 Jun 2007 00:29:41 +0100 Subject: [erlang-questions] Determine architecture - the erlang way?? In-Reply-To: References: Message-ID: <20070601232941.GE22451@zork.net> begin Logan, Martin quotation: > Let me rephrase my ambiguous request and elaborate. I am looking for a > library written in Erlang that will allow me to determine the > architecture of a system in such a way as to ensure that C code > previously compiled for that architecture class will run on it. > > Would using some combination of erlang:system_info(system_architecture) erlang:system_info(hipe_architecture) work ? The output on various systems: 1> erlang:system_info(system_architecture). "i686-pc-linux-gnu" 1> erlang:system_info(system_architecture). "i386-unknown-freebsd6.2" 1> erlang:system_info(system_architecture). "i386-apple-darwin8.8.1" -- Emad El-Haraty From james.hague@REDACTED Fri Jun 1 19:18:13 2007 From: james.hague@REDACTED (James Hague) Date: Fri, 1 Jun 2007 12:18:13 -0500 Subject: [erlang-questions] some language changes In-Reply-To: <20070601110526.90F6D5A200@mail.erlangsystems.com> References: <20070601110526.90F6D5A200@mail.erlangsystems.com> Message-ID: > Why not take a fresh start and cook up a new syntax, i.e ErlangRedux. > > Initially, the mandatory requirement should be: > > * make use of the existing (super strong) Beam engine. > * the general semantics of Erlang processes should be preserved > * hot code loading must still work > * the distribution mechanism must also be preserved > > Apart from this, cook up a nice concise syntax! This is an excellent idea! Most of the complaints about Erlang can easily be skirted at the syntactic level, and do NOT require any changes to the concurrency model or the runtime environment. Even changes that sound drastic can be easily mapped to BEAM, but I'd say the first goal should be a source to source translator, so the results can be run through the existing Erlang compiler. Stuff that's doable: * destructive updates of local variables (that is, removing the single-assignment property) * local functions * ability to use any function as a guard * changing of scope rules, including adding "let...in" and "where" constructs * a replacement for records * indentation-based syntax (no more commas and semicolons and so on) * list comprehensions that step through multiple lists simultaneously instead of in a nested manner * more concise type info in patterns You get the idea :) From m5@REDACTED Sat Jun 2 04:51:24 2007 From: m5@REDACTED (Mike McNally) Date: Fri, 1 Jun 2007 21:51:24 -0500 Subject: [erlang-questions] some language changes In-Reply-To: References: <20070601110526.90F6D5A200@mail.erlangsystems.com> Message-ID: <20070602025124.GC1715@works.com> > Stuff that's doable: > > * destructive updates of local variables (that is, removing the > single-assignment property) AAAAA!!!!!! Absolutely no. > * local functions ?? > * ability to use any function as a guard No. > * changing of scope rules, including adding "let...in" and "where" constructs Terrible for maintainability and readbility. > * a replacement for records Fine. > * indentation-based syntax (no more commas and semicolons and so on) Horrible beyond description. > * list comprehensions that step through multiple lists simultaneously > instead of in a nested manner Possibly. > * more concise type info in patterns *Maybe*, if somebody can explain how that can be done efficiently. -- [ I love pre-moistened towelettes ] Mike McNally -- m5@REDACTED From tim@REDACTED Sat Jun 2 09:41:53 2007 From: tim@REDACTED (Tim Bates) Date: Sat, 02 Jun 2007 17:11:53 +0930 Subject: [erlang-questions] GS instability in Erlang tools Message-ID: <46611F41.8050601@bates.id.au> Hi all, When using the Erlang debugging programs, available via toolbar:start(), I frequently get the following: GS frontend. Last mgs in was:{<0.118.0>,{destroy,2454}} exit:{<0.118.0>,{destroy,2454}} Reason: {'EXIT', {function_clause, [{gs_frontend, remove_objs, [15, {error, {{badmatch,[]}, [{gstk_db,opt,3}, {gstk_gridline,delete,2}, {gstk,delete_only_this_widget,2}, {gstk,destroy_impl,2}, {gstk,doit,2}, {gstk,loop,1}]}}]}, {gs_frontend,doit,2}, {gs_frontend,loop,1}]}} 11> =ERROR REPORT==== 2-Jun-2007::16:59:55 === Error in process <0.36.0> with exit value: {{badmatch,[]},[{gstk_db,opt,3},{gstk_gridline,delete,2},{gstk,delete_only_this_widget,2},{gstk,destroy_impl,2},{gstk,doit,2},{gstk,loop,1}]} This occurs when doing innocuous things such as clicking the 'Next' button in a debugger window and a few other circumstances that don't appear to be quite as repeatable. I've seen this: http://www.erlang.org/ml-archive/erlang-questions/200604/msg00076.html but that appears to be referring to errors in a user-developed GS application and not part of OTP. I also get this: Internal error... restarting. 3> =ERROR REPORT==== 2-Jun-2007::17:05:44 === Error in process <0.77.0> with exit value: {function_clause,[{lists,nthtail,[2,[]]},{tv_pg_gridfcns,resize_grid,3},{tv_pg,loop,1}]} sometimes when attempting to resize the window showing the contents of an ets table in the Table Viewer. I don't recall having these problems before R11B-4 but then I've changed to a new computer at roughly the same time so it could be related to the Erlang version or TK version (8.4.9 and 8.4.14) or even the hardware platform (AMD64 X2). Is anyone else having these problems? Thanks in advance, Tim. -- Tim Bates tim@REDACTED From luke.gorrie@REDACTED Sat Jun 2 10:05:36 2007 From: luke.gorrie@REDACTED (Luke Gorrie) Date: Sat, 02 Jun 2007 10:05:36 +0200 Subject: [erlang-questions] regexp sux! References: <45F27E12.2000102@ericsson.com> <45F47F3F.20009@telia.com> <4650365F.5080500@telia.com> <200705210602.l4L62hkT012941@shell.accesscom.com> <200705211555.l4LFtCjV074597@shell.accesscom.com> Message-ID: Darius Bacon writes: > There's no attempt to conform to any standard, and the regex parser > ought to be replaced with a real one that understands char ranges, > inverted char classes, escaping, etc. I was too lazy to add this so instead I wrote a linter for the result of regexp:parse that tells you if the regexp can loop forever. I hope it's correct :-) %% %% Regexp linter: reject regexps that can put the matcher into an %% infinite loop, i.e. anything that can consider infinitely many %% matches of the empty string. %% lint_regexp(R) -> case catch match_empty(R) of false -> ok; true -> ok; {error, Reason} -> {error, Reason} end. %% Return true if R can match an empty string. %% Throw an error if R could put the matcher into an infinite loop. match_empty(R) -> case R of {kclosure,X} -> check_nonempty(X), true; {pclosure,X} -> check_nonempty(X), false; {optional, _} -> true; {concat,A,B} -> match_empty(A) and match_empty(B); {'or',A,B} -> match_empty(A) or match_empty(B); empty -> true; _ -> false end. check_nonempty(R) -> case match_empty(R) of true -> throw({error,nonterminating}); false -> ok end. From tom@REDACTED Sat Jun 2 10:11:29 2007 From: tom@REDACTED (Tom Samplonius) Date: Sat, 2 Jun 2007 01:11:29 -0700 (PDT) Subject: [erlang-questions] Rabbit In-Reply-To: Message-ID: <12069276.2901180771889159.JavaMail.root@ly.sdf.com> Does anyone here know of a mailing list or forum for RabbitMQ? As it is written in erlang, I would assume the RabbitMQ developers hang around here too. I'm interested in a Stomp connector for RabbitMQ. ----- "Chandru" wrote: > Seen this? > > http://www.rabbitmq.com/ > > cheers > Chandru > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions From luke@REDACTED Sat Jun 2 10:26:40 2007 From: luke@REDACTED (Luke Gorrie) Date: Sat, 02 Jun 2007 10:26:40 +0200 Subject: [erlang-questions] Patch for erlang.el (optional debug_info on compile) References: Message-ID: Hi Bill! > At present, erlang-mode doesn't provide any way to compile an erlang > file for debug - you have to manually do the debug compile in an > Erlang shell. Once upon a time debug_info was the default. But this was changed since the way it's implemented is to include the whole parse tree in the beam file which (a) causes bloat and (b) lets bad guys like me read your code :-) If you don't care then put this in e.g. ~/.bashrc to enable it globally: export ERL_COMPILER_OPTIONS='[debug_info]' From luke.gorrie@REDACTED Fri Jun 1 00:46:51 2007 From: luke.gorrie@REDACTED (Luke Gorrie) Date: Fri, 01 Jun 2007 00:46:51 +0200 Subject: [erlang-questions] Patch for erlang.el (optional debug_info on compile) References: Message-ID: Hi Bill! > At present, erlang-mode doesn't provide any way to compile an erlang > file for debug - you have to manually do the debug compile in an > Erlang shell. Once upon a time debug_info was the default. But this was changed since the way it's implemented is to include the whole parse tree in the beam file which (a) causes bloat and (b) lets bad guys like me read your code :-) If you don't care then put this in e.g. ~/.bashrc to enable it globally: export ERL_COMPILER_OPTIONS='[debug_info]' From tobbe@REDACTED Fri Jun 1 08:51:31 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 01 Jun 2007 08:51:31 +0200 Subject: [erlang-questions] some language changes In-Reply-To: <465EE0DA.6070701@ericsson.com> References: <9b08084c0705210110o7c24d1f6v966b1c8a57a9b0d3@mail.gmail.com> <465D8165.8060707@ericsson.com> <465EE0DA.6070701@ericsson.com> Message-ID: Why not take a fresh start and cook up a new syntax, i.e ErlangRedux. Initially, the mandatory requirement should be: * make use of the existing (super strong) Beam engine. * the general semantics of Erlang processes should be preserved * hot code loading must still work * the distribution mechanism must also be preserved Apart from this, cook up a nice concise syntax! I guess this could hook into existing Hipe backends in an initial approach, Then some good libraries should be written on top of this, which could be done as a comunity effort. All this could be hosted on a community server (making use of 'git' for decentralized development of course :-) Not sure how hard it would be to implement a new syntax like this, but I'm sure several people on the list could do a good estimation of the efforts involved. Cheers, Tobbe From luke.gorrie@REDACTED Fri Jun 1 00:37:08 2007 From: luke.gorrie@REDACTED (Luke Gorrie) Date: Fri, 01 Jun 2007 00:37:08 +0200 Subject: [erlang-questions] regexp sux! References: <45F27E12.2000102@ericsson.com> <45F47F3F.20009@telia.com> <4650365F.5080500@telia.com> <200705210602.l4L62hkT012941@shell.accesscom.com> <200705211555.l4LFtCjV074597@shell.accesscom.com> Message-ID: Darius Bacon writes: > There's no attempt to conform to any standard, and the regex parser > ought to be replaced with a real one that understands char ranges, > inverted char classes, escaping, etc. I was too lazy to add this so instead I wrote a linter for the result of regexp:parse that tells you if the regexp can loop forever. I hope it's correct :-) %% %% Regexp linter: reject regexps that can put the matcher into an %% infinite loop, i.e. anything that can consider infinitely many %% matches of the empty string. %% lint_regexp(R) -> case catch match_empty(R) of false -> ok; true -> ok; {error, Reason} -> {error, Reason} end. %% Return true if R can match an empty string. %% Throw an error if R could put the matcher into an infinite loop. match_empty(R) -> case R of {kclosure,X} -> check_nonempty(X), true; {pclosure,X} -> check_nonempty(X), false; {optional, _} -> true; {concat,A,B} -> match_empty(A) and match_empty(B); {'or',A,B} -> match_empty(A) or match_empty(B); empty -> true; _ -> false end. check_nonempty(R) -> case match_empty(R) of true -> throw({error,nonterminating}); false -> ok end. From joelr1@REDACTED Sat Jun 2 11:39:13 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 2 Jun 2007 10:39:13 +0100 Subject: [erlang-questions] Scheme on the Erlang VM In-Reply-To: References: <9b08084c0705210110o7c24d1f6v966b1c8a57a9b0d3@mail.gmail.com> <465D8165.8060707@ericsson.com> <465EE0DA.6070701@ericsson.com> Message-ID: On Jun 1, 2007, at 7:51 AM, Torbjorn Tornkvist wrote: > Why not take a fresh start and cook up a new syntax, i.e ErlangRedux. What about Scheme on the Erlang VM? It may sound crazy but it's in line with my renewed interest in compilers and my latest project (Topdog). I would certainly like the syntax! Cheers, Joel -- http://topdog.cc - EasyLanguage to C# translator http://wagerlabs.com - Blog From chlorophil@REDACTED Sat Jun 2 12:27:39 2007 From: chlorophil@REDACTED (Philip Robinson) Date: Sat, 2 Jun 2007 20:27:39 +1000 Subject: [erlang-questions] Scheme on the Erlang VM In-Reply-To: References: <9b08084c0705210110o7c24d1f6v966b1c8a57a9b0d3@mail.gmail.com> <465D8165.8060707@ericsson.com> <465EE0DA.6070701@ericsson.com> Message-ID: On 6/2/07, Joel Reymont wrote: > > What about Scheme on the Erlang VM? I would *love* a Scheme/Lisp on the Erlang VM. (Especially with real macros!) Philip From per@REDACTED Sat Jun 2 13:33:10 2007 From: per@REDACTED (Per Hedeland) Date: Sat, 2 Jun 2007 13:33:10 +0200 (CEST) Subject: [erlang-questions] erlang-mode emacs tabs vs spaces In-Reply-To: Message-ID: <200706021133.l52BXAG7022151@pluto.hedeland.org> "Matthew O'Gorman" wrote: > >I am an emacs user, I just work with vim users as well and think it is >very silly to be so utterly inconsistent. The fix, the line i >proposed or others should be trivial to add to the erlang-mode. AFAIK the tabs-in-indentation usage that is the default in erlang-mode is "emacs standard" - certainly at least cc-mode, shell-script-mode, and perl-mode do the same by default. And whatever you think of this "feature" (I can agree with "silly", but not "inconsistent", let alone "utterly"), I don't think erlang.el should hardwire something that it is different from "standard default". You found the customization knob, fine (and thanks for reporting it), now you - or any project that decides on it - just need to use it. --Per Hedeland From tobbe@REDACTED Fri Jun 1 11:12:26 2007 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Fri, 01 Jun 2007 11:12:26 +0200 Subject: [erlang-questions] language changes, fresh start Message-ID: Hm...were did my previous post go...? I'm resending it (via gmane): ------------ Why not take a fresh start and cook up a new syntax, i.e ErlangRedux. Initially, the mandatory requirement should be: * make use of the existing (super strong) Beam engine. * the general semantics of Erlang processes should be preserved * hot code loading must still work * the distribution mechanism must also be preserved Apart from this, cook up a nice concise syntax! I guess this could hook into existing Hipe backends in an initial approach, Then some good libraries should be written on top of this, which could be done as a comunity effort. All this could be hosted on a community server (making use of 'git' for decentralized development of course :-) Not sure how hard it would be to implement a new syntax like this, but I'm sure several people on the list could do a good estimation of the efforts involved. Cheers, Tobbe ------------ From anders.nygren@REDACTED Sat Jun 2 01:36:26 2007 From: anders.nygren@REDACTED (Anders Nygren) Date: Fri, 1 Jun 2007 18:36:26 -0500 Subject: [erlang-questions] Determine architecture - the erlang way?? In-Reply-To: <20070601232941.GE22451@zork.net> References: <20070601232941.GE22451@zork.net> Message-ID: On 6/1/07, Emad El-Haraty wrote: > begin Logan, Martin quotation: > > Let me rephrase my ambiguous request and elaborate. I am looking for a > > library written in Erlang that will allow me to determine the > > architecture of a system in such a way as to ensure that C code > > previously compiled for that architecture class will run on it. > > > > > > > > Would using some combination of > erlang:system_info(system_architecture) > erlang:system_info(hipe_architecture) > work ? > > The output on various systems: > 1> erlang:system_info(system_architecture). > "i686-pc-linux-gnu" > > 1> erlang:system_info(system_architecture). > "i386-unknown-freebsd6.2" > > 1> erlang:system_info(system_architecture). > "i386-apple-darwin8.8.1" > > There is also 1> os:type(). {unix,sunos} 2> os:version(). {5,10,0} 3> erlang:system_info(system_architecture). "i386-pc-solaris2.10" This on an AMD64 something. -bash-3.00$ uname -a SunOS suny 5.10 Generic_118855-14 i86pc i386 i86pc /Anders From joelr1@REDACTED Sat Jun 2 12:28:28 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 2 Jun 2007 11:28:28 +0100 Subject: [erlang-questions] Scheme on the Erlang VM In-Reply-To: <200706021022.l52AMUv8009718@harpo.it.uu.se> References: <200706021022.l52AMUv8009718@harpo.it.uu.se> Message-ID: On Jun 2, 2007, at 11:22 AM, Mikael Pettersson wrote: > The main issue is mutable data structures: composite Erlang > terms (cons cells, tuples, binaries) are immutable, but Lisp > and Scheme require the ability to destructively update fields > in such terms. I don't think this is an absolute requirement for Scheme. Also, "mutability" can be implemented, just like in Erlang, by returning a copy of the original data structure. -- http://topdog.cc - EasyLanguage to C# translator http://wagerlabs.com - Blog From joelr1@REDACTED Sat Jun 2 10:28:39 2007 From: joelr1@REDACTED (Joel Reymont) Date: Sat, 2 Jun 2007 09:28:39 +0100 Subject: [erlang-questions] Who wrote the BDB backend for Mnesia? Message-ID: <7A53D86E-87B8-4E89-A121-14D2E61A1C9F@gmail.com> Folks, Do you know who wrote the BDB backend for Mnesia? I'm working on a new Mnesia backend and would love to talk to this person. Thanks, Joel -- http://topdog.cc - EasyLanguage to C# translator http://wagerlabs.com - Blog From datacompboy@REDACTED Sat Jun 2 17:19:47 2007 From: datacompboy@REDACTED (datacompboy) Date: Sat, 02 Jun 2007 16:19:47 +0100 Subject: [erlang-questions] calling fun() from fun() References: Message-ID: <20070602151947.C1BF55A1FC@mail.erlangsystems.com> that's easy! FibI = fun   (X,_) when X<1 -> throw(badarith);   (1,_) -> 1;   (2, _) -> 1;   (X,FibI) -> FibI(X-1,FibI)+FibI(X-2,FibI) end, Fib = fun(X) -> FibI(X, FibI) end, Fib(10). it produce correct result -- 55. So, you just should pass it to itself, and if you must use one-arg fun (for example, to pass it to somewhere), make additional fun that will call real fun with additional arg. -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org From datacompboy@REDACTED Sat Jun 2 17:32:05 2007 From: datacompboy@REDACTED (datacompboy) Date: Sat, 02 Jun 2007 16:32:05 +0100 Subject: [erlang-questions] is there something like #line References: Message-ID: <20070602153205.8B81F5A1FC@mail.erlangsystems.com> Guest wrote: Bjorn Gustavsson wrote: -handle_call -handle_info -handle_cast (end of quote) for handle_call, handle_info, handle_cast, put actual handlers into separate functions. so your server will consist of 3 parts:   % public   action(X) -> gen_server:call(?MODULE, {action, X}).   % actions   do_action(X) -> io:format("I'm do ~p, do you know?!~n", [X]).   % handler   ...   handle_call(.., {action, X}, ..) -> {reply, do_action(X)},   ... before real actions you can easy insert -file(). mine two cents about "why <<;>>, <<.>> and <>": (note about SHOULD and MUST as in RFC). 1st: usability. when you have all code for one fun in one place, you see all clauses near. you SHOULD separate fun to several, if you fun take more that one screen. (exception -- loong case list, like action callers. but looong case list SHOULD be only callers to action funs, that, of course, should fit into one screen). 2nd: order of preference. when you have all parts together, you able to write: myfun(0,_) -> 0; myfun(_,0) -> 1. and know that on call myfun(0,0) you get 0, not 1. again -- as they close, you see that order. if you have 1st clause in start of file, and 2nd in end -- you will not sure... 3rd: ; and . -- that 1st: strict you to writing close, 2nd: allow to find misstype like definition support fun with same count of arguments; 3rd: make unify syntax for cases and cases. -- --- suicide proc near\n call death\n suicide endp _________________________________________________________ Post sent from http://www.trapexit.org From goertzen@REDACTED Sat Jun 2 15:49:27 2007 From: goertzen@REDACTED (Daniel Goertzen) Date: Sat, 02 Jun 2007 08:49:27 -0500 Subject: [erlang-questions] Scheme on the Erlang VM In-Reply-To: References: <9b08084c0705210110o7c24d1f6v966b1c8a57a9b0d3@mail.gmail.com> <465D8165.8060707@ericsson.com> <465EE0DA.6070701@ericsson.com> Message-ID: <46617567.6050101@ertw.com> I would also love to see a lisp for erlang... perhaps one that compiles to erlang source? (would that make sense?) Dan. Philip Robinson wrote: > On 6/2/07, Joel Reymont wrote: > >> What about Scheme on the Erlang VM? >> > > I would *love* a Scheme/Lisp on the Erlang VM. > > (Especially with real macros!) > > Philip > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > > From james.hague@REDACTED Sat Jun 2 22:28:49 2007 From: james.hague@REDACTED (James Hague) Date: Sat, 2 Jun 2007 15:28:49 -0500 Subject: [erlang-questions] some language changes In-Reply-To: <20070602025124.GC1715@works.com> References: <20070601110526.90F6D5A200@mail.erlangsystems.com> <20070602025124.GC1715@works.com> Message-ID: > > * destructive updates of local variables (that is, removing the > > single-assignment property) > > AAAAA!!!!!! Absolutely no. There's absolutely nothing wrong with it. It's exactly the same as: A = A A1 = A + B A2 = A1 + 5 etc., but less ugly. And it's easy to do in BEAM while still avoiding destructive updates of *data structures*. People have requested this in Erlang before, and the main problem that it conflicts with the semantics of pattern matching. But BEAM supports it just fine. James From robert.virding@REDACTED Sat Jun 2 23:44:00 2007 From: robert.virding@REDACTED (Robert Virding) Date: Sat, 02 Jun 2007 23:44:00 +0200 Subject: [erlang-questions] calling fun() from fun() In-Reply-To: <20070602151947.C1BF55A1FC@mail.erlangsystems.com> References: <20070602151947.C1BF55A1FC@mail.erlangsystems.com> Message-ID: <4661E4A0.9000707@telia.com> That's easy, you need the Y-combinator! y(M) -> G = fun (F) -> M(fun(A) -> (F(F))(A) end) end, G(G). and then you define you fun with a fun wrapper like so: Fac -> fun (F) -> fun (0) -> 1; (N) -> N * F(N-1) end end. and call it like: (y(Fac))(5) 120 Voila! No need to add extra arguments or anything. It only works for funs of one argument, but, hey, what are tuples for? Robert P.S. You're code examples came out real funny in the mail. datacompboy wrote: > that's easy! > > FibI = fun >   (X,_) when X<1 -> throw(badarith); >   (1,_) -> 1; >   (2, _) -> 1; >   (X,FibI) -> FibI(X-1,FibI)+FibI(X-2,FibI) > end, > Fib = fun(X) -> FibI(X, FibI) end, > Fib(10). > > > it produce correct result -- 55. > So, you just should pass it to itself, and if you must use one-arg fun (for example, to pass it to somewhere), make additional fun that will call real fun with additional arg. > -- > --- suicide proc near\n call death\n suicide endp > _________________________________________________________ > Post sent from http://www.trapexit.org > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > From emcconne@REDACTED Sun Jun 3 04:41:39 2007 From: emcconne@REDACTED (Brent McConnell) Date: Sun, 3 Jun 2007 02:41:39 +0000 Subject: [erlang-questions] Why does this happen? Message-ID: <12621b4f0706021941p6fc6d357wa21c668c5a322bbb@mail.gmail.com> I am new to Erlang and have been playing in the shell. I have some behavior that seems odd when importing the lists module and wanted to ask a more knowledgeable audience why it does this. In the first few lines I define a list and a function, import lists and then map the function. I then clear variables and start again but this time I import lists before defining the function and it fails. Why? 8> f(). ok 9> X=[1,2,3,4]. [1,2,3,4] 10> Y=fun(Z)->Z*Z end. #Fun 11> Y(2). 4 12> Y(4). 16 13> import (lists). ok 14> lists:map(Y,X). [1,4,9,16] 15> f(). ok 16> import (lists). ok 17> X=[1,2,3,4]. [1,2,3,4] 18> Y=fun(Z)->Z*Z end. =ERROR REPORT==== 3-Jun-2007::02:31:08 === Error in process <0.45.0> with exit value: {badarg,[{erlang,atom_to_list,[{module,lists}]},{erl_lint,'-unused_vars/3-fun-0-',2},{orddict,filter,2},{orddict,filter,2},{erl_lint,unused_vars,3},{erl_lint,check_unused_vars,3},{erl_lint,fun_clause,3},{erl_lint,'-fun_clauses/3-fun-0-'... ** exited: {badarg,[{erlang,atom_to_list,[{module,lists}]}, {erl_lint,'-unused_vars/3-fun-0-',2}, {orddict,filter,2}, {orddict,filter,2}, {erl_lint,unused_vars,3}, {erl_lint,check_unused_vars,3}, {erl_lint,fun_clause,3}, {erl_lint,'-fun_clauses/3-fun-0-',3}]} ** 19> -------------- next part -------------- An HTML attachment was scrubbed... URL: From erlangx@REDACTED Sun Jun 3 05:07:35 2007 From: erlangx@REDACTED (Michael McDaniel) Date: Sat, 2 Jun 2007 20:07:35 -0700 Subject: [erlang-questions] Why does this happen? In-Reply-To: <12621b4f0706021941p6fc6d357wa21c668c5a322bbb@mail.gmail.com> References: <12621b4f0706021941p6fc6d357wa21c668c5a322bbb@mail.gmail.com> Message-ID: <20070603030735.GG1520@delora.autosys.us> Works fine on my system $ uname -a Linux delora 2.6.20-15-386 #2 Sun Apr 15 07:34:00 UTC 2007 i686 GNU/Linux eshell V5.5.3 (R11B-4) mmcdanie@REDACTED:~/misc/src/erlang$ erl Erlang (BEAM) emulator version 5.5.3 [async-threads:0] [hipe] [kernel-poll:false] => reading /home/mmcdanie/.erlang => ** Found 0 name clashes in code paths Eshell V5.5.3 (abort with ^G) 1> f(). ok 2> X=[1,2,3,4]. [1,2,3,4] 3> 3> Y=fun(Z)->Z*Z end. #Fun 4> Y(2). 4 5> Y(4). 16 6> import(lists). ok 7> lists:map(Y,X). [1,4,9,16] 8> f(). ok 9> lists:map(Y,X). ** 1: variable 'Y' is unbound ** 10> X=[1,2,3,4]. [1,2,3,4] 11> Y=fun(Z)->Z*Z end. #Fun 12> lists:map(Y,X). [1,4,9,16] ~M On Sun, Jun 03, 2007 at 02:41:39AM +0000, Brent McConnell wrote: > I am new to Erlang and have been playing in the shell. I have some behavior > that seems odd when importing the lists module and wanted to ask a more > knowledgeable audience why it does this. In the first few lines I define a > list and a function, import lists and then map the function. I then clear > variables and start again but this time I import lists before defining the > function and it fails. Why? > > 8> f(). > ok > 9> X=[1,2,3,4]. > [1,2,3,4] > 10> Y=fun(Z)->Z*Z end. > #Fun > 11> Y(2). > 4 > 12> Y(4). > 16 > 13> import (lists). > ok > 14> lists:map(Y,X). > [1,4,9,16] > 15> f(). > ok > 16> import (lists). > ok > 17> X=[1,2,3,4]. > [1,2,3,4] > 18> Y=fun(Z)->Z*Z end. > > =ERROR REPORT==== 3-Jun-2007::02:31:08 === > Error in process <0.45.0> with exit value: {badarg,[{erlang,atom_to_list, > [{module,lists}]},{erl_lint,'-unused_vars/3-fun-0-',2},{orddict,filter,2}, > {orddict,filter,2},{erl_lint,unused_vars,3},{erl_lint,check_unused_vars,3}, > {erl_lint,fun_clause,3},{erl_lint,'-fun_clauses/3-fun-0-'... > > ** exited: {badarg,[{erlang,atom_to_list,[{module,lists}]}, > {erl_lint,'-unused_vars/3-fun-0-',2}, > {orddict,filter,2}, > {orddict,filter,2}, > {erl_lint,unused_vars,3}, > {erl_lint,check_unused_vars,3}, > {erl_lint,fun_clause,3}, > {erl_lint,'-fun_clauses/3-fun-0-',3}]} ** > 19> > > !DSPAM:52,46622c3918341335313201! > _______________________________________________ > erlang-questions mailing list > erlang-questions@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-questions > > !DSPAM:52,46622c3918341335313201! -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 From tty.erlang@REDACTED Sun Jun 3 05:24:17 2007 From: tty.erlang@REDACTED (t ty) Date: Sat, 2 Jun 2007 23:24:17 -0400 Subject: [erlang-questions] Why does this happen? In-Reply-To: <20070603030735.GG1520@delora.autosys.us> References: <12621b4f0706021941p6fc6d357wa21c668c5a322bbb@mail.gmail.com> <20070603030735.GG1520@delora.autosys.us> Message-ID: <290b3ba10706022024j47e017d9ped4fd1979d90533c@mail.gmail.com> I can cut the example down to: Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.5.4 (abort with ^G) 1> import(lists). ok 2> Y = fun(Z) -> Z*Z end. =ERROR REPORT==== 2-Jun-2007::23:22:30 === Error in process <0.31.0> with exit value: {badarg,[{erlang,atom_to_list,[{module,lists}]},{erl_lint,'-unused_vars/3-fun-0-',2},{orddict,filter,2},{erl_lint,unused_vars,3},{erl_lint,check_unused_vars,3},{erl_lint,fun_clause,3},{erl_lint,'-fun_clauses/3-fun-0-'... ** exited: {badarg,[{erlang,atom_to_list,[{module,lists}]}, {erl_lint,'-unused_vars/3-fun-0-',2}, {orddict,filter,2}, {erl_lint,unused_vars,3}, {erl_lint,check_unused_vars,3}, {erl_lint,fun_clause,3}, {erl_lint,'-fun_clauses/3-fun-0-',3}, {lists,foldl,3}]} ** uname -a is Linux localhost 2.6.20-16-generic #2 SMP Wed May 23 01:46:23 UTC 2007 i686 GNU/Linux Regards t From ok@REDACTED Fri Jun 1 05:09:40 2007 From: ok@REDACTED (ok) Date: Fri, 1 Jun 2007 15:09:40 +1200 Subject: [erlang-questions] some language changes In-Reply-To: <465F44BD.9050304@telia.com> References: <9b08084c0705210110o7c24d1f6v966b1c8a57a9b0d3@mail.gmail.com> <200705212007.09584.als@iinet.net.au> <9b08084c0705210324p67bb5e1bhba34fb5cccd2db57@mail.gmail.com> <465A0917.3000708@telia.com> <24B71F00-013F-4756-B7BE-84C07E98C6E5@cs.otago.ac.nz> <465F44BD.9050304@telia.com> Message-ID: I mentioned the Eiffel "{ }" syntax. On 1 Jun 2007, at 9:57 am, Robert Virding wrote: > I would have no trouble accepting either just as long as you have > NO QUOTING at all. Not PHP '' strings where you need to quote both > \ and '. The Eiffel way adds extra lines and can break up an > expression. If you want to include chunks of one language inside another, you have to have SOME kind of quoting. Take shell 'here' documents as an example: <<'EOF' ... ... EOF Every line is taken literally, up to but excluding the EOF line (a line that is identical to the word following <<). Use <<-'EOF' instead, and leading tabs will be stripped from the data lines, so you can indent the document nicely. (This is rather like the "{ -vs- "[ distinction in Eiffel.) Remove the quotes from 'EOF' (so <