|
|
|
|
|
by runeks
3630 days ago
|
|
> I think its because until recently pattern matching and
> algebraic data types (a more robust alternative to
> switch statements) [...]
Could you elaborate a bit on what this accomplishes, eg. pattern matching vs a "case" statement? As I've programmed in Haskell for the past year or two, I've observed exactly this change in my style of writing - that I've started to get rid of "case" statements inside function definitions, and have moved them into the pattern-matching part instead ("outside" the function definition).But I have to admit, I'm not entirely sure why I do this. It just feels more robust to me in some way. |
|
The case-expression vs function-definition difference you mentioned from Haskell is just syntactic sugar. In both situations you are doing exactly the same pattern matching under the hood.