Methods
Included Modules
Attributes
[RW] first
[RW] second
Public Class methods
[](*array)
# File lib/facets/more/lisp.rb, line 65
    def DottedPair.[](*array)
      if array.empty?
        nil
      else
        DottedPair.new(array.shift, DottedPair[*array])
      end
    end
new(first = nil, second = nil)
# File lib/facets/more/lisp.rb, line 59
    def initialize(first = nil, second = nil)
      @first, @second = first, second
    end
Public Instance methods
==(other)
# File lib/facets/more/lisp.rb, line 104
    def ==(other)
      if pair?(self) and pair?(other)
        car(self) == car(other) and cdr(self) == cdr(other)
      else
        if pair?(self) then false else self == other end
      end
    end
each(&block)
# File lib/facets/more/lisp.rb, line 73
    def each(&block)
      if @first
        if @first.is_a? DottedPair
          @first.each(&block)
        else
          block.call(@first)
        end
      end
      if @second
        if @second.is_a? DottedPair
          @second.each(&block)
        else
          block.call(@second)
        end
      end
    end
inspect()
# File lib/facets/more/lisp.rb, line 94
    def inspect
      '(' + repr + ')'
    end
to_a()
# File lib/facets/more/lisp.rb, line 98
    def to_a
      a = []
      each { |e| a << e }
      a
    end
to_s()
# File lib/facets/more/lisp.rb, line 90
    def to_s
      '(' + repr + ')'
    end
Protected Instance methods
repr()
# File lib/facets/more/lisp.rb, line 114
    def repr
      case @second
        when DottedPair then @first.to_s + ' ' + @second.repr
        when nil then @first.to_s
        else @first.to_s + ' . ' + @second.to_s
      end
    end