Class: Nydp::Builtin::StringPieces

Inherits:
Object
  • Object
show all
Defined in:
lib/nydp/builtin/to_string.rb

Instance Method Summary collapse

Instance Method Details

#invoke(vm, args) ⇒ Object



23
24
25
# File 'lib/nydp/builtin/to_string.rb', line 23

def invoke vm, args
  vm.push_arg Nydp::StringAtom.new to_string(args.car, args.cdr)
end

#to_string(first, rest) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/nydp/builtin/to_string.rb', line 15

def to_string first, rest
  if Nydp.NIL.is? rest
    first.to_s
  else
    "#{first.to_s}#{to_string rest.car, rest.cdr}"
  end
end