class Lisp::PrimRelational

Public Class Methods

gt_impl(args, env) click to toggle source
# File lib/rubylisp/prim_relational.rb, line 28
def self.gt_impl(args, env)
  return Lisp::Boolean.with_value(args.car.value > args.cadr.value)
end
gteq_impl(args, env) click to toggle source
# File lib/rubylisp/prim_relational.rb, line 36
def self.gteq_impl(args, env)
  return Lisp::Boolean.with_value(args.car.value >= args.cadr.value)
end
lt_impl(args, env) click to toggle source
# File lib/rubylisp/prim_relational.rb, line 24
def self.lt_impl(args, env)
  return Lisp::Boolean.with_value(args.car.value < args.cadr.value)
end
lteq_impl(args, env) click to toggle source
# File lib/rubylisp/prim_relational.rb, line 32
def self.lteq_impl(args, env)
  return Lisp::Boolean.with_value(args.car.value <= args.cadr.value)
end
register() click to toggle source
# File lib/rubylisp/prim_relational.rb, line 5
def self.register
  Primitive.register("<", "2", "(< number number)\n\nReturns whether the first argument is less than the second argument.") do |args, env|
    Lisp::PrimRelational::lt_impl(args, env)
  end

  Primitive.register(">", "2", "(> number number)\n\nReturns whether the first argument is greater than the second argument.") do |args, env|
    Lisp::PrimRelational::gt_impl(args, env)
  end

  Primitive.register("<=", "2", "(<= number number)\n\nReturns whether the first argument is less than or equal to the second argument.") do |args, env|
    Lisp::PrimRelational::lteq_impl(args, env)
  end

  Primitive.register(">=", "2", "(>= number number)\n\nReturns whether the first argument is greater than or equal to the second argument.") do |args, env|
    Lisp::PrimRelational::gteq_impl(args, env)
  end
end