[Haskell-beginners] Repeat function application x times?

Felipe Almeida Lessa felipe.lessa at gmail.com
Sat Jul 23 08:28:42 CEST 2011


It's straightforward to define it using iterate:

  applyN :: (a -> a) -> Int -> a -> a
  applyN f n x = iterate f x !! n

Cheers,

-- 
Felipe.



More information about the Beginners mailing list