37 lines
1.0 KiB
Markdown
Raw Normal View History

2024-12-07 21:07:38 +01:00
---
type: mixed
---
### Stuff
- Definition and syntax of lists
- List comprehension:
- Set comprehensions and list comprehension
- Generators (pattern <- list expression)
- Tests (Boolean expressions within list comprehension)
- Multiple generators and dependent generators
- Meaning of list comprehensions
- Important list functions:
- `length`
- `++` (concatenation)
- `reverse`
- `replicate`
- `head`, `last`, `tail`, `init`
- `take`, `drop`
- `concat`
- `zip`, `unzip`
- `and`, `or`, `sum`, `product`
- Pattern matching on lists:
- Constructors: `[]` (empty list) and `:` (cons operator)
- Patterns and pattern matching using wildcards (_)
- Recursion over lists
- Indexing lists using `!!` operator
- Examples:
- `concat` function using primitive recursion
- `insertionSort` function
- `zip` and `take` functions using multiple arguments in recursion
- `quickSort` function using general recursion
- `reverse'` function using an accumulating parameter
- `ups` function (finding maximal ascending sublists) using an accumulating parameter