noritsuguの日記

2009-04-08``Algorithms'' (33) Exercise 2.4

f l = reverse (f' l [])
    where f' []     r = r
          f' (x:xs) r = (2*x) : (f' xs r)

で、

*Main> f [1, 2, 3, 4]
[8,6,4,2]
*Main> reverse $ map (*2) [1, 2, 3, 4]
[8,6,4,2]
トラックバック - http://haskell.g.hatena.ne.jp/noritsugu/20090408