1
0
Fork 0

expanded haskell lists

main
Sebastian Steger 2025-11-14 13:50:46 +01:00
parent 8da0378153
commit ea530aa44c
1 changed files with 6 additions and 4 deletions

View File

@ -85,13 +85,15 @@ Expression | Type (:t) | Value | Comment
Expression | Type (:t) | Value | Comment
--- | --- | --- | --------
`[1,7,4]` | `Num a => [a]` | `[1,7,4]` |
`[]` | `[a]` | `[]` |
`8 : [1,7,4]` | `Num a => [a]` | `[8,1,7,4]` | **cons** operator, short for construct
`1:7:4:[]` | `Num a => [a]` | `[1,7,4]` | actual construction of a list
`[1,7,4] ++ [8]` | `Num a => [a]` | `[1,7,4,8]` |
`(++)` | `[a] -> [a] -> [a]` | |
`[1,7,4]` | `Num a => [a]` | `[1,7,4]` |
`8 : [1,7,4]` | `Num a => [a]` | `[8,1,7,4]` | **cons** operator, short for construct
`[1,7,4]` | `[Num a] => [a]` | `[1,7,4]` |
`(++)` | `[a] -> [a] -> [a]` | |
`[1,7,4] ++ [8]` | `Num a => [a]` | `[1,7,4,8]` |
`[1,7,4] !! 2` | `Num a => [a]` | `4` |
`(!!)` | `[a] -> Int -> a` | |
`head [1,7,4]` | `Num a => a` | `1` | Similar `last`
`tail [1,7,4]` | `[Num a] => [a]` | `[7,4]` | Similar `init`
`length [1,7,4]` | `Int` | `3` |