Why Nostr? What is Njump?
2024-12-12 03:29:56

J3RN :fedora: :elixir: :emacs: on Nostr: #Haskell question: Is there a function for "reapply this function to a starting value ...

#Haskell question: Is there a function for "reapply this function to a starting value N times"? e.g. `doTimes (*2) 3 1` would return `8` ((*2) $ (*2) $ (*2) $ 1). I know I could chain take and iterate and then do a Data.List.last, but that has crumby performance for very large values of N.
Author Public Key
npub1a673fkpvw5s632ydeppgr760z3q6cuwsys05ur068ag93gdqw6cqraqhg7