# File lib/lambda.rb, line 17 def call(*args) locals = if @formals.is_a? Sym # rest args { @formals => args.to_list } else # regular arg list raise BusScheme::ArgumentError, "Wrong number of args passed to #{@symbol}. expected #{@formals.size}, got #{args.size} in #{@file}:#{@line}" if @formals.length != args.length @formals.zip(args).to_hash end @scope = RecursiveHash.new(locals, @enclosing_scope) # we dupe the lambda so that @scope is unique for each call of the function @@stack << self.dup begin return BusScheme.eval(@body.unshift(:begin.sym)) ensure @@stack.pop end end