• Create Account

### #ActualTelastyn

Posted 23 January 2012 - 09:07 AM

In addition to Koobs' answer, it's often used as an inline branching mechanism in functional languages where you would've used switch statements (or a pile of if/else blocks) in imperative languages. Since functional languages often use more list/tuple manipulation and stuff like Maybe/Nothing the scenario arises more often there.

[edit: so the Maybe/Nothing stuff (and even the tuples) are properly called Algebraic Data Types. The common example is working with a tree:
match node with
| Leaf x -> // do stuff with x
| Branch left right ->
// recurse left
// recurse right

]

### #2Telastyn

Posted 23 January 2012 - 08:31 AM

In addition to Koobs' answer, it's often used as an inline branching mechanism in functional languages where you would've used switch statements (or a pile of if/else blocks) in imperative languages. Since functional languages often use more list/tuple manipulation and stuff like Maybe/Nothing the scenario arises more often there.

### #1Telastyn

Posted 23 January 2012 - 08:30 AM

In addition to Koobs' answer, it's often used as an inline branching mechanism in functional languages where you would've used switch statements in imperative languages. Since functional languages often use more list/tuple manipulation and stuff like Maybe/Nothing the scenario arises more often there.

PARTNERS