Class: Nydp::Builtin::Hash

Inherits:
Object show all
Includes:
Base, Helper, Singleton
Defined in:
lib/nydp/builtin/hash.rb

Instance Method Summary collapse

Methods included from Helper

#cons, #list, #literal?, #pair?, #sig, #sym, #sym?

Methods included from Converter

#n2r, #r2n

Methods included from Base

#builtin_invoke_1, #builtin_invoke_2, #builtin_invoke_3, #builtin_invoke_4, #handle_error, #inspect, #invoke, #invoke_1, #invoke_2, #invoke_3, #invoke_4, #name, #nydp_type, #to_s

Instance Method Details

#build_hash(h, args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/nydp/builtin/hash.rb', line 10

def build_hash h, args
  return h if Nydp::NIL.is? args
  k = args.car
  rest = args.cdr
  v = rest.car
  h[k] = v
  build_hash h, rest.cdr
end

#builtin_invoke(vm, args) ⇒ Object



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

def builtin_invoke vm, args
  vm.push_arg(build_hash Nydp::Hash.new, args)
end