Class: Nydp::Builtin::GreaterThan

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

Instance Method Summary collapse

Instance Method Details

#greater_than(arg, args) ⇒ Object



6
7
8
9
# File 'lib/nydp/builtin/greater_than.rb', line 6

def greater_than arg, args
  return true if Nydp.NIL.is? args
  (arg > args.car) && greater_than(args.car, args.cdr)
end

#invoke(vm, args) ⇒ Object



2
3
4
# File 'lib/nydp/builtin/greater_than.rb', line 2

def invoke vm, args
  vm.push_arg (greater_than(args.car, args.cdr) ? Nydp.T : Nydp.NIL)
end