chain

object Function {
  def chain[X](fs: Collection[(X) => X]): (X) => X
}

chain creates an anonymous function that accepts a value and returns the result of sequentially applying all the functions contained in the collection fs.