Comment on Lisp Flavoured Erlang 1.0 released after 8 years of developmentComments−jarpineh10yThis looks really interesting. I installed it easily through Brew. REPL seems to work fast.Now if my Clojure flawored Lisp starter level knowledge could be somehow transformed into Erlang flawor...I wrote this: > (map (lists:seq 1 10) (lambda (a) (io:format a))) and this happened: #M((1 2 3 4 5 6 7 8 9 10) #Fun<lfe_eval.12.88887576>) So, I'm not quite there yet. Hopefully somebody can make a Clojure to LFE comparison.And using Elixir based things like Phoenix springs to mind...−strmpnk10yMap is a constructor in this case. You'll want lists:map/2 (fn comes first). I don't know LFE much so there may be sugar of sorts for this, perhaps a comprehension syntax.−rvirding10yYes, there are list comprehensions but they return the list of values:(lc ((<- x (lists:seq 1 10))) (lfe_io:format "~p" x))−jarpineh10yThank you both. I didn't realize how Erlang flawored this really is. This did the trick: > (lists:map (lambda (a) (io:format (integer_to_list a))) (lists:seq 1 10)) Though all those OKs look kind of superfluous. I must read Erlang tutorial or two before I proceed.−macintux10yio:format is a side-effecting function. It prints to the terminal. The atom ok is the return value.If you want to create a list of strings, this works: > (lists:map (lambda (a) (lists:flatten (io_lib:format "~B" (list a)))) (lists:seq 1 10)). ("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
Comments
This looks really interesting. I installed it easily through Brew. REPL seems to work fast.
Now if my Clojure flawored Lisp starter level knowledge could be somehow transformed into Erlang flawor...
I wrote this:
and this happened: So, I'm not quite there yet. Hopefully somebody can make a Clojure to LFE comparison.And using Elixir based things like Phoenix springs to mind...
Map is a constructor in this case. You'll want lists:map/2 (fn comes first). I don't know LFE much so there may be sugar of sorts for this, perhaps a comprehension syntax.
Yes, there are list comprehensions but they return the list of values:
(lc ((<- x (lists:seq 1 10))) (lfe_io:format "~p" x))
Thank you both. I didn't realize how Erlang flawored this really is. This did the trick:
Though all those OKs look kind of superfluous. I must read Erlang tutorial or two before I proceed.io:format is a side-effecting function. It prints to the terminal. The atom ok is the return value.
If you want to create a list of strings, this works: