
20 Aug
2014
20 Aug
'14
6:10 a.m.
Dimitri DeFigueiredo
writes:
Here's a simple exercise from Stephanie Weirich's class [1] that I am having a hard time with.
consider
doTwice :: (a -> a) -> a -> a doTwice f x = f (f x)
what does this do?
ex1 :: (a -> a) -> a -> a ex1 = doTwice doTwice
Another way to write doTwice is: doTwice :: (a -> a) -> (a -> a) doTwice f = \x -> f (f x) This is equivalent. If you stare it for a while, it should answer the rest of your questions. John