--
infix 4 `inlist` tag1 x = (1,x) x `inlist` [] = False x `inlist` (y:ys) = if x==y then True else x `inlist` ys mymap :: (a -> b) -> [a] -> [b] mymap f [] = [] mymap f (x:xs) = (f x) : (mymap f xs) mysum [] = 0 mysum (x:xs) = (+) x (mysum xs) myprod [] = 1 myprod (x:xs) = (*) x (myprod xs) myand [] = True myand (x:xs) = (&&) x (myand xs) myfoldr op e [] = e myfoldr op e (x:xs) = op x (myfoldr op e xs) k x = \ y -> x plusn n = (\ x -> x + n) x = [1,2,3,4] y = ["a","b","c","d"] next n a = (a + (n/a) )/ 2.0 within eps (a : b : rest) = if abs( (a/b) -1.0 ) <= eps then b else within eps (b : rest) split 0 x = ([],x) split n [] = ([],[]) split n (x:xs) = (x:ys,zs) where (ys,zs) = split (n-1) xs --