|
|
|
|
|
by yetkin
2036 days ago
|
|
Out of curiosity, why match expressions became popular for non functional languages? Without pattern matching on datatypes via cons expression (x::xs matching) it is just another kind of switch or if/else. Why do people promote this?
here a nice comment on this topic:
https://ocaml.org/learn/tutorials/data_types_and_matching.ht... "So one Really Cool Feature of functional languages is the ability to break apart data structures and do pattern matching on the data. This is again not really a "functional" feature - you could imagine some variation of C appearing which would let you do this, but it's a Cool Feature nonetheless" |
|