2 ms·
This isn't a functional technique! Functional languages remove assignments and mutable variables. Not branches.
by ori_b 16y ago
This isn't a functional technique! Functional languages remove assignments and mutable variables. Not branches.
- BoppreH 16y agoBranches too. The only conditionals I've seen in functional programming are equivalent to the ternary operator. Unless I'm absurdly wrong, which can happen.
- davidw 16y agoThe program still branches (decides which code path to follow) - it just does it with a different mechanism, for instance pattern matching.
- BoppreH 16y agoYes, pattern matching fits the bill, thanks.
- ori_b 16y agoI think codesearch can answer you: http://www.google.com/codesearch?q=if+lang%3Ahaskell http://www.google.com/codesearch?q=if+lang%3Ahaskell
- BoppreH 16y ago"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.