Zusammenfassung der Ressource
Haskell - Recursion
- Edge condition
- Is some scenario where a recursive application doesn't make sense
- Usually in the lists, the edge condition is often the empty list
- In the numbers, often the edge case value turns out to be an identity
- There are no the while loops
- There are no the for loops
- Is very important
- You save time with the recursion
- Haskell have many recursive functions
- Replicate
- Takes an Int and some element and returns a list that has several repetitions of the same element
- Take
- It takes a certain number of elements from a list
- Reverse
- Simply reverses a list
- Sorting types
- Quick Sort
- Recursive thinking
- Try to think of when a recursive solution doesn't apply and see if you can use that as an edge case
- Think about identities and think about whether you'll break apart the parameters of the function