Method: Cons.from_array
- Defined in:
- lib/cons.rb
.from_array(array) ⇒ Object
354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/cons.rb', line 354 def from_array array car, *cdr = array result = current = Cons.new while car and not car.nil? current.car = car current.cdr = Cons.new if cdr and not cdr.empty? current = current.cdr car, *cdr = cdr end result end |