Standard Prelude

-- Element selection
> head [1, 2, 3]
1

> tail [1, 2, 3]
[2, 3]

> [1, 2, 3] !! 2
2

> take 2 [1, 2, 3]
[1, 2]

-- List calculation
> product [1, 2, 3]
6

-- List operation
> [1, 2] ++ [3, 4]
[1, 2, 3, 4]

> reverse [1, 2, 3]
[3, 2, 1]

Function Applicatoin

Math                    Haskell
---------------------------------
f(x)                    f x
f(x, y)                 f x y
f(g(x))                 f (g x)
f(x, g(y))              f x (g y)
f(x) g(y)               f x * g y

Syntactic Suger

x `f` y == f x y

Naming Requirements

  • Functions begin with a lower-case letter

Naming Conventions

  • List arguments have a suffix s

Layout Rule

  • In a sequence of definitions, each sequence must begin in precisely the same column

results matching ""

    No results matching ""