Class: Array

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

Instance Method Summary collapse

Instance Method Details

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



2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
# File 'lib/nendo.rb', line 2453

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