Chapter 2 Summary
Useful highlights from the chapter.
A list of the chapter contents, including past stumbling blocks.
- Create a list:
[5..13]
or[5,10..100]
or[ n^2 | n<-[1..100], even n]
- Create a tuple:
(5,12)
- Key to remember: head, tail, init, last,
:
,++
- Other list functions: maximum, minimum, sum, product, reverse
- More list functions: length, null, take, drop
- Sometimes useful: cycle, repeat, replicate
- Misc:
!!
,zip
- Double quotes make strings.
- Single quotes make individual characters.
- Strings are lists of characters, so “dog” == [’d’,‘o’,‘g’]