module Tins::ProcPrelude
def apply(&my_proc)
def apply(&my_proc) my_proc or raise ArgumentError, 'a block argument is required' lambda { |list| my_proc.call(*list) } end
def array
def array lambda { |*list| list } end
def call(obj, &my_proc)
def call(obj, &my_proc) my_proc or raise ArgumentError, 'a block argument is required' obj.instance_eval(&my_proc) end
def const(konst = nil, &my_proc)
def const(konst = nil, &my_proc) konst ||= my_proc.call lambda { |*_| konst } end
def first
def first lambda { |*list| list.first } end
def from(&block)
def from(&block) my_method, binding = block.call, block.binding my_self = eval 'self', binding lambda { |*list| my_self.__send__(my_method, *list) } end
def id1
def id1 lambda { |obj| obj } end
def last
def last lambda { |*list| list.last } end
def map_apply(my_method, *args, &my_proc)
def map_apply(my_method, *args, &my_proc) my_proc or raise ArgumentError, 'a block argument is required' lambda { |x, y| my_proc.call(x, y.__send__(my_method, *args)) } end
def nth(n)
def nth(n) lambda { |*list| list[n] } end
def rotate(n = 1)
def rotate(n = 1) lambda { |*list| list.rotate(n) } end
def second
def second lambda { |*list| list[1] } end
def tail
def tail lambda { |*list| list[1..-1] } end