Skip to content

Instantly share code, notes, and snippets.

@rsp
Created November 30, 2017 16:34
Show Gist options
  • Select an option

  • Save rsp/b6d3a3338b9c0f66bd908b22bce26a41 to your computer and use it in GitHub Desktop.

Select an option

Save rsp/b6d3a3338b9c0f66bd908b22bce26a41 to your computer and use it in GitHub Desktop.
inFullMobile Language Wars: Round 1 - Haskell Solution 1 by @domhys - See: https://gist.github.com/rsp/d8bdbafa09f24f99eebc8ed60fe205c8
composeXTimes :: (a -> a) -> Int -> a -> a
composeXTimes f x = foldr (.) id (replicate x f)
f :: (Num a1, Num t) => ((a1 -> a1) -> t -> Int) -> (a -> a) -> a -> a
f a g x = composeXTimes g h x
where h = ((a incr 0) - 1) where incr x = x + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment