[erlang-questions] Funargs: Ruby-like blocks for Erlang
Fri Jul 22 02:17:35 CEST 2011
On Thu, Jul 21, 2011 at 3:48 PM, Richard O'Keefe <ok@REDACTED> wrote:
> And YEEK! The argument list here
> looks like nothing else in Erlang whatever!
> Surely surely surely Erlang should look like Erlang!
> lists:map([1,2,3,4,5]) do (N) -> N*2 end
And to address your point a little more here, no I don't think "|" isn't
Erlangy anymore than I feel it isn't Ruby-like. The "|" ... "|" syntax in
Ruby looks like nothing else in Ruby whatsoever, but it's still
aesthetically pleasing. Certainly much more so than "(" ... ")" "->" ...
Nor do I feel the stabby is necessary here any more than I feel the "def"
token is needed when defining an anonymous function in Ruby. The "do" token
alone signifies you're defining an anonymous function and matches to the
corresponding "end" token. I don't believe it should be any problem to add
Erlang guard syntax into the grammar as-is, I just omitted it because I knew
this patch is admittedly a bit of a joke.
This is where the margin turns negative.
> What has mapping to do with "DO"?
The do is what the mapping does. The "do" keyword is completely intuitive to
me in that what follows is a function which does something. I suppose the
only cognitive dissonance here is that functional programmers go out of
their way to not think of their programs as actually doing something, which
may make sense in a lazy language like Haskell where your program may indeed
never actually do anything, but if you feel that way about a language with
strict evaluation like Erlang you're just kidding yourself.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions