Mind map
Syntax in Functions

Map content
Syntax in Functions
Pattern matching
- when creating a function, the body can separate into patterns
- You can pattern match on any data type
- unordered sentences in patterns might generate infinite loops
- we should always include a general pattern
- _ any data from the list
- we should always include a general pattern
- you have to define the patterns for whatever entrance
The lists themselves can also use patterns.
Guards, guards!
- The guards are a way to check if any property of a value (or several of them) is true or false.
- the patterns are usually used with the guards
- if all the guards of a pattern are executed and they are false, we continue with the following pattern
- they follow the name of a function and its parameters
- has a little bleeding to the right and aligned
- A guard is basically a Boolean expression
- it is discouraged to write guards online are not very readable
where is located after the guards to calculate a varibale and then that variable compare it using the guards
- it is best to apply sangria
- The names that we define in this section are only visible for that function
- the variables must be aligned correctly
- If you want multiple patterns of a function to access a shared name, you must define it globally.
Where bindings are a syntactic construct that let you bind to variables at the end of a function and the whole function can see them, including all the guards.
- The names that you define in the let part are accessible to the expression after the in part
- If we want to link several variables online, obviously we can not align them in columns That's why we can separate them with semicolons.
Case expressions
Images and files in the map
Information
- Description
- Mind Map on Syntax in Functions, created by CASTILLO ZAMBRANO LUIS FELIPE on 15/02/2018.
- Created by
- CASTILLO ZAMBRANO LUIS FELIPE
- Views
- 1
- Rating


