Zusammenfassung der Ressource
Haskell - Syntax in Functions
- Pattern matching
- we need to specify the patterns to which some data should conform
- We can't use ++ in pattern matches
- can define separate function bodies for different patterns
- Recursion
- We should use catch-all pattern
- Unexpected inputs
- Always need to match the pattern with the list comprehensions
- Is possible modify the default functions
- Guards
- guards are a way of testing whether some property of a value (or several of them) are true or false
- Guards are indicated by pipes that follow a function's name and its parameters
- Works like an if but they are more readable
- Let
- bindings let you bind to variables anywhere
- Are expressions of themselves
- Case expressions
- Is possible evaluate expressions based on the possible cases of the value of a variable
- Are useful for pattern matching against something in the middle of an expression