module Nydp::Helper
Public Instance Methods
cons(a=nil, b=nil)
click to toggle source
# File lib/nydp/helper.rb, line 79 def cons a=nil, b=nil Nydp::Pair.new a, b end
list(*args)
click to toggle source
# File lib/nydp/helper.rb, line 83 def list *args Nydp::Pair.from_list args end
literal?(expr)
click to toggle source
# File lib/nydp/helper.rb, line 91 def literal? expr case expr # when String, Float, Integer, Integer, Symbol, Nydp::Truth, Nydp::Nil # when String, Float, Integer, Integer, Symbol, Nydp::Truth, NilClass when String, Float, Integer, Integer, Symbol, TrueClass, FalseClass, NilClass true else false end end
pair?(expr)
click to toggle source
# File lib/nydp/helper.rb, line 75 def pair? expr expr.is_a?(Nydp::Pair) end
sig(klass)
click to toggle source
# File lib/nydp/helper.rb, line 55 def sig klass case klass when Nydp::Symbol ; "SYM" when Nydp::ContextSymbol ; "LEX" when Nydp::Literal ; "LIT" when Nydp::FunctionInvocation ; "NVK" when Nydp::Invocation::Base ; "NVB" when Nydp::InterpretedFunction ; "IFN" when Nydp::Cond ; "CND" when Nydp::CondBase ; "CND" when Nydp::Assignment ; "ASN" else ; raise "no sig for #{klass.class.name}" end end
sym(name, ns)
click to toggle source
# File lib/nydp/helper.rb, line 87 def sym name, ns name.to_s.to_sym end
sym?(expr, name)
click to toggle source
# File lib/nydp/helper.rb, line 70 def sym? expr, name # expr.is_a?(Nydp::Symbol) && (expr.is? name) expr.is_a?(::Symbol) && (expr == name.to_sym) end