class Elparser::SExpListDot

(list . last)

Public Class Methods

new(list, last) click to toggle source
# File lib/elparser.rb, line 183
def initialize(list, last)
  @list = list
  @last = last
end

Public Instance Methods

car() click to toggle source
# File lib/elparser.rb, line 187
def car
  @list[0]
end
cdr() click to toggle source
# File lib/elparser.rb, line 190
def cdr
  if @list.size == 2 then
    SExpCons.new(@list[1], @last)
  else
    SExpListDot.new(@list.slice(1..-1),@last)
  end
end
list?() click to toggle source
# File lib/elparser.rb, line 197
def list?
  false
end
to_ruby() click to toggle source
# File lib/elparser.rb, line 207
def to_ruby
  @list.map {|i| i.to_ruby}.push(@last.to_ruby)
end
to_s() click to toggle source
# File lib/elparser.rb, line 200
def to_s
  "("+@list.map{|i| i.to_s }.join(" ") + " . #{@last.to_s})"
end
visit(&block) click to toggle source
# File lib/elparser.rb, line 203
def visit(&block)
  @list = @list.map(&block)
  @last = block.call(@last)
end