betw a b == [a] <| a>=b |> a : betw (a+1) b addup [] == 0 addup (a:b) == add a (addup b) add a b == a+b mul a b == a*b max a b == a <| a>b |> b inc a == a+1 sqr a == a*a odd a == a%2=1 divis a b == a%b=0 notdiv a b == a%b != 0 fold op z [] == z fold op z (hd:rest) == op hd (fold op z rest) map op [] == [] map op (hd:rest) == (op hd): (map op rest) map2 op n [] == [] map2 op n (hd:rest) == (op hd n): (map2 op n rest) map3 op n [] == [] map3 op n (hd:rest) == (op n hd): (map3 op n rest) filter test [] == [] filter test (hd:rest) == hd: filter test rest <| test hd |> filter test rest filter2 test n [] == [] filter2 test n (hd:rest) == hd: filter2 test n rest <| test hd n |> filter2 test n rest intsfrom n == n : intsfrom (n+1) first 0 list == [] first n (hd:rest) == hd : first (n-1) rest first n [] == [] process (hd:rest) == hd : process (filter2 notdiv hd rest) append [] b == b append (hd:tl) b == hd : append tl b addto hd list == hd:list prefs [] == [] prefs (hd:tl) == [hd] : map3 addto hd (prefs tl) subs [] == [[]] subs (hd:tl) == append (prefs (hd:tl)) (subs tl) rndseq seed ==(500+seed%500) : rndseq (69069069*seed+78131) insert n [] == [n] insert n (hd:rest) == n:hd:rest <| n hd : insert n rest sort [] == [] sort (hd:rest) == insert hd (sort rest) item 1 (hd:rest) == hd item n (hd:rest) == item (n-1) rest minlist L == item 1 (sort L)