Jump to content

User:Ruud Koot/Function composition

From Wikipedia, the free encyclopedia
compose :: (b -> c) -> (a -> b) -> (a -> c)
compose f g = \x -> f (g x)
def compose(f, g):
  def nest(x):
    return f(g(x))
  return nest