Re:No ifs...alternatives to statement branching in JavaScript
by ori_b on Friday August 06, 2010 @11:37PM
(#1583013)
This isn't a functional technique! Functional languages remove assignments and mutable variables. Not branches.
[ Parent
| on HN ]
Re:No ifs...alternatives to statement branching in JavaScript
by BoppreH on Friday August 06, 2010 @11:47PM
(#1583022)
Branches too. The only conditionals I've seen in functional programming are equivalent to the ternary operator.
Unless I'm absurdly wrong, which can happen.
Re:No ifs...alternatives to statement branching in JavaScript
by davidw on Saturday August 07, 2010 @02:24AM
(#1583168)
The program still branches (decides which code path to follow) - it just does it with a different mechanism, for instance pattern matching.
Re:No ifs...alternatives to statement branching in JavaScript
by BoppreH on Saturday August 07, 2010 @03:05PM
(#1584081)
Yes, pattern matching fits the bill, thanks.
Re:No ifs...alternatives to statement branching in JavaScript
by ori_b on Saturday August 07, 2010 @10:52AM
(#1583633)
I think codesearch can answer you: http://www.google.com/codesearch?q=if+lang%3Ahaskell
Re:No ifs...alternatives to statement branching in JavaScript
by BoppreH on Saturday August 07, 2010 @03:02PM
(#1584076)
"if"s in Haskell work exactly like the ternary operators, just as I said. I was using the article's differentiation of "branching" and "microbranching" and stating that I haven't seen the former in functional languages.
The link provided doesn't contradict any of this, actually it does quite the opposite.