Haskell - lecture 5
-- Lambda functions are specified with a backslash.
-- (\x -> x*(x-1)) 4 = 12
-- (\x -> (\y -> ((+) y 1))) 2 3 = 4
-- (\x -> (\y -> ((/) x y))) 10 2 = 5.0
-- (\y -> ((+) y x)) 5 = ERROR - Undefined variable "x"
-- (\x -> (\z -> ((/) z 2)) x) 3 = 1.5
-- (\x -> (\z -> ((*) x z)) x) 3 = 9
0 Comments:
Post a Comment
<< Home