#!/usr/bin/ruby class Array def rest retval = self.clone retval.shift return retval end def foldLeft(function) if self.size == 1 return self.first else return function.call(self.first, self.rest.foldLeft(function)) end end def eachAfter(element, &block) self[((self.index(element) or -1) + 1)..-1].each { |x| yield x } end def eachStartWith(element, &block) self[(self.index(element) or 0)..-1].each { |x| yield x } end end class Fixnum def not_equal?(num) self != num end end class Set def include_any?(enum) enum.each { |e| if self.include?(e) return true end } return false end end class Hash def include_hash?(hash) hash.each { |k,v| return false unless self[k] == v } return true end end