codesnippets:patternmatching
This is an old revision of the document!
Pattern matching, again
There was already some pattern matching explained, in the context of bindings here. Here we explain pattern matching in other contexts, which are:
- function definitions
- list comprehensions
- do notations
Before we start with that, we provide more details about pattern matching, regarding:
- lists
- algebraic data types
- tuples
Context: function definition
- binding actual parameters (“caller perspective”) to parameters (“inner function perspective”)
- select the structure of data, to pick cases
- binds parameter names, to define the function itself
- example:
You could leave a comment if you were logged in.
codesnippets/patternmatching.1618394428.txt.gz · Last modified: (external edit)
