Class: Array

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

Instance Method Summary collapse

Instance Method Details

#to_list(lastAtom = nil) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/nendo.rb', line 105

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