Class: Array

Inherits:
Object show all
Defined in:
lib/array_extensions.rb

Instance Method Summary collapse

Instance Method Details

#restObject Also known as: cdr

Lisp-style list access



3
4
5
# File 'lib/array_extensions.rb', line 3

def rest
  self[1 .. -1]
end

#to_listObject Also known as: to_sexp



10
11
12
13
14
15
16
# File 'lib/array_extensions.rb', line 10

def to_list
  if self.cdr.empty?
    BusScheme::Cons.new(self.car, nil)
  else
    BusScheme::Cons.new(self.car, self.cdr.to_list)
  end
end