High order functions for Ruby