--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
--
One thing to consider is that those functions are very much inspired by Clojure, while LFE has historically embraced a CL/MACLISP lineage. So, just from a consistency and style perspective, including the Clojure-inspired stuff might be a little schizophrenic...That being said, I constantly use the Clojure-inspired functions :-) I personally don't mind including lutil/include/core.lfe when I need them. (And yes, your repeat function will get merged!)dP.S. I've begun a new library that will do two things: 1) take the most generally useful includes from lutil, and 2) explore a unifying interface across various similar data types in Erlang (e.g., list-like, dict-like, set-like). Ideally, the ultimate solution will be a common set of functions that will work across not only applicable data types from the Erlang standard library, but also any community-created libraries that declare a list-like, set-like, dict-like, etc., behaviour. Not quite sure how I'm going to do this yet, but it might required custom data types to be gen_servers with a new function that then stores the type (and reference to the module implementing the functions) so that the core library could call back into it. That's going to require a lot of experimentation to get right.
One thing to consider is that those functions are very much inspired by Clojure, while LFE has historically embraced a CL/MACLISP lineage. So, just from a consistency and style perspective, including the Clojure-inspired stuff might be a little schizophrenic...
On Friday, June 5, 2015 at 5:11:59 PM UTC+2, Duncan McGreggor wrote:One thing to consider is that those functions are very much inspired by Clojure, while LFE has historically embraced a CL/MACLISP lineage. So, just from a consistency and style perspective, including the Clojure-inspired stuff might be a little schizophrenic...You are right; for a moment, I forgot the 'L' in 'LFE' actually stands for 'Lisp', not 'Clojure'.Short background: a while ago, I used Clojure for a short project. I had no prior knowledge of any Lisp-like language, yet I was able to get the basic hang of Clojure in a few days. I do not know what the Lisp way is, but the Clojure way is pretty damn awesome.
So anyway, I was thinking we could make LFE better (in the most subjective sense) by including some Clojure-like functionality (Clojure on the BEAM? Sounds awesome!), but I can see now how that might be unwelcome and perhaps better kept in a separate library.I guess what I'm trying to say is, sorry for trying mess up your thing :)
While the discussion has been interesting it has wandered away from my original intent. This was to define a set of core LFE functions that aren't just the existing Erlang ones. So of my original list probably only eval should remain. So what we have now at this base level is:
- the LFE core forms
- the erlang module of Erlang base functions
- a set of LFE core macros
So my question really was do we need a set of LFE base functions as well? The list I showed was some functions I picked up out the CL manual and probably only 'eval' should remain. But are there others at this level we need? So this is not about library functions but below that.
We should probably make a module 'cl' containing a set of CL standard functions which would include most mine, plus a bunch more. Then we provide them but are are explicit. This could very well be a part of the standard LFE release.
Robert
On Friday, June 5, 2015 at 5:44:14 AM UTC+2, Robert Virding wrote:Today we can reach all the erlang BIFs from LFE. They are all in the module erlang but many we can reach without prefixing with the module, the same ones as we can from erlang. I plan to create a set of LFE BIFs which will be in the module lfe and which can also be reached without prefixing the module. In one sense these will be part of the LFE language/system in the same way as we have a collection of standard macros. So far I have plucked out a few from the CL book:acons, pairlis, assoc, assoc-if, assoc-if-not, rassoc, rassoc-if, rassoc-if-not, subst, subst-if, subst-if-not, sublis, evalI have no intention of adding interface functions to the standard erlang BIFs. This is not a replacement of the libraries in anyway it just defining which functions are part of the LFE "system".I am open to suggestions for functions that would be reasonable to include here.Robert
On Sun, Jun 7, 2015 at 7:00 PM, Robert Virding <rvir...@gmail.com> wrote:While the discussion has been interesting it has wandered away from my original intent. This was to define a set of core LFE functions that aren't just the existing Erlang ones. So of my original list probably only eval should remain. So what we have now at this base level is:
- the LFE core forms
- the erlang module of Erlang base functions
- a set of LFE core macros
So my question really was do we need a set of LFE base functions as well? The list I showed was some functions I picked up out the CL manual and probably only 'eval' should remain. But are there others at this level we need? So this is not about library functions but below that.
We should probably make a module 'cl' containing a set of CL standard functions which would include most mine, plus a bunch more. Then we provide them but are are explicit. This could very well be a part of the standard LFE release.That's a *great* idea :-)
So my question really was do we need a set of LFE base functions as well? The list I showed was some functions I picked up out the CL manual and probably only 'eval' should remain. But are there others at this level we need? So this is not about library functions but below that.
On Sun, Jun 7, 2015 at 7:02 PM, Duncan McGreggor <duncan.m...@gmail.com> wrote:On Sun, Jun 7, 2015 at 7:00 PM, Robert Virding <rvir...@gmail.com> wrote:While the discussion has been interesting it has wandered away from my original intent. This was to define a set of core LFE functions that aren't just the existing Erlang ones. So of my original list probably only eval should remain. So what we have now at this base level is:
- the LFE core forms
- the erlang module of Erlang base functions
- a set of LFE core macros
So my question really was do we need a set of LFE base functions as well? The list I showed was some functions I picked up out the CL manual and probably only 'eval' should remain. But are there others at this level we need? So this is not about library functions but below that.
We should probably make a module 'cl' containing a set of CL standard functions which would include most mine, plus a bunch more. Then we provide them but are are explicit. This could very well be a part of the standard LFE release.That's a *great* idea :-)Hrm, one more thought about this: it might be nice to1) define the functions in an include like lfe/include/cl.lfe, and then2) include this in a module like lfe/src/cl.lfeThis would allow users to take either approach: treat it like a library, making calls such as (cl:mapcar ...) or treat it like a "built-in" by including it and just calling (mapcar ...).
A 'cl' module seems like a good idea, could even include it in the base LFE release. But I am not fond of defining functions in an include file as you then will define many functions in your module which you don't use or even know about. I would prefer to define them in 'cl'. You could, however, have a 'cl' include for defining the standard 'cl' macros.
I am looking at if we could have macros defined in a file and call them like (cl:macro ...) so you don't need the include. This is just speculation for now, it would be feasible but whether it is practical is another question.
--
You received this message because you are subscribed to a topic in the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lisp-flavoured-erlang/uDt3IX3jnm8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lisp-flavoured-e...@googlegroups.com.
Mário: I agree that LFE should stand on itself, however, all of Erlang stdlib is available out of the box in LFE. So it kind of stands on the shoulders of Erlang already :)Then again, there is always room for improvement. The Erlang stdlib is certainly not perfect, but it's kind of useless to run rampant defining aliases for core Erlang functions, because we don't like their current names. As an example of what I think is a nice improvement, repeat in lutil/include/core.lfe works as an alias for lists:duplicate - unless you pass in a function, in which case the duplicate elements are constructed by repeated calls to the function (Clojure's repeat and repeatedly in one).That being said, I think LFE should at least provide function composition and partial application (from lutil's include/compose.lfe), and perhaps even the threading operators. Not sure about other stuff atm.Another thing, shouldn't LFE include lfex/ltest? Erlang certainly comes with unit testing macros; I see no reason for not including such macros in LFE directly.
Oh, and has anyone looked at rebar3 LFE integration?
It would be better for LFE to come already with definitions for the common functions of map, fold, etc, even if those are just aliases for Erlang counterparts, so that we could write (map ...) instead of (lists:map ...) for two reasons:Hi Adam,I don't know if I quite understood your point but here it goes mine:1st) the code would be more succint and clear2nd) everyone would use the same aliases instead of their own, thus making the code more consistent across different programmersHaving more high-level functions out-of-the-box, e.g., function composition, would be a plus as well.And having a good FFI to C/C++ would be greater.
MGhhuumm , don't know if I understood your rationale. Let me put this way:What is the difference between coding a NIF (a real pain) or having a general FFI library that would do much the same that a NIF does? For example, I do not see any difference between a NIF or using an FFI with respect to distribution and fault tolerance ...
Robert,all those requirements are satisfied by NIFs, but a much nicer FFI would exempt programmers from dealing with details like converting data structures between Erlang/LFE and C, as needed when writing NIFs.
It seems that such FFI has never been a priority for Erlang, probably:
1) because most projects where Erlang has been used seldom have that need,
2) or because the way to interface Erlang to other languages should be via distributed message passing across language nodes, not via FFI, which makes perfect sense in the context of a "Let it crash" / fault-tolerant designs (and NIFs are only there just to say "we can call C directly too").
Can you tell me if the case for the lack of a nicer FFI is 1) or 2), or something else?
My guess is 2), and that's fine: it's Erlang's/LFE's way of making its systems resilient to failures.
CheersMG
2015-06-14 3:43 GMT+01:00 Robert Virding <rvir...@gmail.com>:
On Thursday, June 11, 2015 at 6:57:07 PM UTC+2, Mário Guimarães wrote:MGhhuumm , don't know if I understood your rationale. Let me put this way:What is the difference between coding a NIF (a real pain) or having a general FFI library that would do much the same that a NIF does? For example, I do not see any difference between a NIF or using an FFI with respect to distribution and fault tolerance ...
I think you have to start looking at what you need in a serious FFI:
- The most basic is a layer so you can call C functions from Erlang and send data backwards and forwards.
- You need to be able to be able to test arguments and extract data from them, basically matching on the arguments.
- You need to be able to safely build erlang data structures so you can return data.
- You need support to be able to run in a multi-threaded environment, includes being able to manage threads inside the C functions so they coexist with the BEAM threads.
You need these things a proper FFI, and that is what NIFs provide. The FFI EEP Duncan mentioned just allows sending binaries between Erlang and C. This would work but would be very limiting and lead to using the such an FFI to be more complex and would basically entail moving the complexity. And you would still need some data functions anyway.
Robert
P.S. In one way this is similar to the issue of whether to write simple server processes by hand or use behaviours. Your simple hand-written server quickly become quite complex when you add the functionality you need and you send up implementing most of the behaviour anyway.
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
On Sunday, June 14, 2015 at 8:24:10 PM UTC+2, Mário Guimarães wrote:Robert,all those requirements are satisfied by NIFs, but a much nicer FFI would exempt programmers from dealing with details like converting data structures between Erlang/LFE and C, as needed when writing NIFs.
How are you then going to pass data between Erlang and C? It has to be done in some way. The internal representations of data inside Erlang are often things you directly want people to access, and they have to be built correctly or you will crash the machine.
CheersMG
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-e...@googlegroups.com.
To post to this group, send email to lisp-flavo...@googlegroups.com.
No dia domingo, 14 de junho de 2015, Robert Virding <rvir...@gmail.com> escreveu:On Sunday, June 14, 2015 at 8:24:10 PM UTC+2, Mário Guimarães wrote:Robert,all those requirements are satisfied by NIFs, but a much nicer FFI would exempt programmers from dealing with details like converting data structures between Erlang/LFE and C, as needed when writing NIFs.
How are you then going to pass data between Erlang and C? It has to be done in some way. The internal representations of data inside Erlang are often things you directly want people to access, and they have to be built correctly or you will crash the machine.Data is passed as done for NIFs, but a nicer FFI would generate the needed conversions from the signature of the C function. There are some efforts in that direction (see https://github.com/parapluu/nifty) but I was expecting this advanced support to come out-of-the-box with Erlang/LFE.
It would be better for LFE to come already with definitions for the common functions of map, fold, etc, even if those are just aliases for Erlang counterparts, so that we could write (map ...) instead of (lists:map ...) for two reasons:Hi Adam,I don't know if I quite understood your point but here it goes mine:1st) the code would be more succint and clear2nd) everyone would use the same aliases instead of their own, thus making the code more consistent across different programmersHaving more high-level functions out-of-the-box, e.g., function composition, would be a plus as well.And having a good FFI to C/C++ would be greater.Cheers,Mário
2015-06-11 14:27 GMT+01:00 Adam Krupicka <krupic...@gmail.com>:
Mário: I agree that LFE should stand on itself, however, all of Erlang stdlib is available out of the box in LFE. So it kind of stands on the shoulders of Erlang already :)Then again, there is always room for improvement. The Erlang stdlib is certainly not perfect, but it's kind of useless to run rampant defining aliases for core Erlang functions, because we don't like their current names. As an example of what I think is a nice improvement, repeat in lutil/include/core.lfe works as an alias for lists:duplicate - unless you pass in a function, in which case the duplicate elements are constructed by repeated calls to the function (Clojure's repeat and repeatedly in one).That being said, I think LFE should at least provide function composition and partial application (from lutil's include/compose.lfe), and perhaps even the threading operators. Not sure about other stuff atm.Another thing, shouldn't LFE include lfex/ltest? Erlang certainly comes with unit testing macros; I see no reason for not including such macros in LFE directly.Oh, and has anyone looked at rebar3 LFE integration? I want to write a rebar3 LFE plugin some time in the coming weeks, if no one has attempted it already.
On Tue, Jun 9, 2015 at 12:39 PM Mário Guimarães <mario.luis.guimaraes@gmail.com> wrote:
Mário$5cWhomever wants other names should do it in another public project.(scheme:xpto ...)(clojure:xpto ...)So we will have:(cl:xpto ...)(racket:xpto ...)more ? If all these come with the base install I think it will distract (can't come up with a better word) programmers leading them to think: "Is this Lisp Flavoured Erlang or CL Flavoured Erlang or Clojure Flavoured Erlang?!?!"
I believe that's too much complication!
LFE must stand on itself and pick modern names for the main/core language functions2015-06-09 10:11 GMT+01:00 Adam Krupicka <krupic...@gmail.com>:
On Tuesday, June 9, 2015 at 1:53:53 AM UTC+2, Robert Virding wrote:A 'cl' module seems like a good idea, could even include it in the base LFE release. But I am not fond of defining functions in an include file as you then will define many functions in your module which you don't use or even know about. I would prefer to define them in 'cl'. You could, however, have a 'cl' include for defining the standard 'cl' macros.
I am looking at if we could have macros defined in a file and call them like (cl:macro ...) so you don't need the include. This is just speculation for now, it would be feasible but whether it is practical is another question.Perhaps it would be best to allow the in-module macro calls and do away with include altogether? Pulling in all the definitions into your module seems like a bad idea. If you include the same include file in multiple modules, do you get multiple definitions of the same functions?In addition, the import statement could be extended to allow importing the whole module instead, something like (import lists).As for the Clojure-like functions, I'm all for keeping them in a separate module, especially if you could import them all with a single statement. I suppose a third-party library could work as well.--You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lisp-flavoured-erlang/uDt3IX3jnm8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.
Visit this group at http://groups.google.com/group/lisp-flavoured-erlang.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Lisp Flavoured Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lisp-flavoured-erlang+unsub...@googlegroups.com.
To post to this group, send email to lisp-flavoured-erlang@googlegroups.com.