Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/nendo/ruby/out_of_module.rb

Instance Method Summary collapse

Instance Method Details

#to_list(lastAtom = false, value = Nendo::Nil.new) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/nendo/ruby/out_of_module.rb', line 45

def to_list( lastAtom = false, value = Nendo::Nil.new )
  if 0 == self.length
    Nendo::Cell.new()
  else
    cells = self.map { |x|
      Nendo::Cell.new( x )
    }
    ptr = cells.pop
    ptr.cdr = value  if lastAtom
    cells.reverse.each { |x|
      x.cdr = ptr
      ptr = x
    }
    return ptr
  end
end