Haskell types [Integer->Integer] -
y = [\a->a+3, \b->1 , \c->c*c]
i recognize function y has type of [integer->integer] , implies return list of function , each function takes integer return integer. however, have trouble figure out input of function , give me example?
there isn't input. y
not expect parameter, provides list of function of type integer -> integer
(or more precisely: num => -> a
).
how can useful?
well, can use in many ways, examples:
>>> let y = [\a->a+3, \b->1 , \c->c*c] >>> map (\f -> f 3) y [6,1,9] >>> sequence y 4 [7,1,16] >>> head y 10 13
Comments
Post a Comment