Review 002

Built-in

Simple

*+-: int or real /: real div: int mod: int binding: [1/a]

Hard

o : (’b -> ’c) * (’a -> ’b ) -> (’a -> ’c) map : ('a -> 'b) -> 'a list -> 'b list map map : ('a -> 'b) list -> ('a list -> 'b list) list fn L = > body List.filter : (’a -> bool) -> ’a list -> ’a list foldr : (’a * ’b -> ’b) -> ’b -> ’a list -> ’b foldl : (’a * ’b -> ’b) -> ’b -> ’a list -> ’b

foldr (op ::) [] == id foldl (op ::) [] == rev

List.concat zip: (‘a list * ‘b list) -> (‘a * ‘b) list filter: ('a -> bool) -> 'a list -> 'a list inord: turn tree into list Fn.id

fun scal f z xs = foldl (fn (x, (last, acc)) => (f(x, last), f(x, last) :: acc)) (z, []) xs

(TODO: more)

Exceptions

Div Match Bind

Tips

For type: write out each sub component

Proof:

16:00 -> 17:15 -> 17:20

Functions!

Table of Content