2 ms·
I have no idea. That's what I would've done. The only thing I can think of is that the article's author doesn't want to have to move between the parentheses.
by nostrademons 18y ago
I have no idea. That's what I would've done.
The only thing I can think of is that the article's author doesn't want to have to move between the parentheses. His initial complaint was that adding a function 'fab' in between foo and bar means you have to rename everything. If you chain the functions in one long expression, you need to navigate to between bar and foo, type 'fab(', then add a separate parentheses onto the end.
It also gets really ugly when foo, bar, and baz are instead line-long expressions, which they often are:
X1 = big_long_expression_containing_some_stuff_and_baz(
big_long_expression_containing_some_stuffand_bar(
big_long_expression_containing_some_stuff_and_foo(X))).
While if you have a sane linebreaking policy (as both Haskell and Eve do), you can do:
X = big_long_expression_containing_some_stuff_and_baz
. big_long_expression_containing_some_stuff_and_bar
. big_long_expression_containing_some_stuff_and_foo
$ x
- davidw 18y ago> It also gets really ugly when foo, bar, and baz are instead line-long expressions, which they often are I sometimes use variables to "take a breather". You do some heavy, syntax and/or meaning laden work, and put the result of all of it in 'current_velocity' or whatever, and that conceptually helps you to move on to the next thing with the result of what you've just done firmly in mind. Single assignment doesn't prevent that, obviously, but sometimes functional code uses them less and just uses a bunch of nested functions. Those Haskell examples you posted seem like a nice idea, by the way. http://journal.dedasys.com/articles/2007/01/17/clockwork-languages http://journal.dedasys.com/articles/2007/01/17/clockwork-lan...