module Rus3::Procedure::Control

Public Instance Methods

map(prc, *lists) click to toggle source
# File lib/rus3/procedure/control.rb, line 11
def map(prc, *lists)
  case lists.size
  when 0
    EMPTY_LIST
  when 1
    raise Rus3::ListRequiredError, lists[0] unless list?(lists[0])
    lists[0].map(&prc)
  else
    zip(*lists).map {|args|
      prc.call(*args)
    }
  end
end
zip(*lists) click to toggle source
# File lib/rus3/procedure/control.rb, line 25
def zip(*lists)
  case lists.size
  when 0
    EMPTY_LIST
  when 1
    lists[0]
  else
    lists[0].zip(*lists[1..-1])
  end
end