class Rake::LinkedList

structures in Rake.
Polylithic linked list structure used to implement several data

def self.cons(head, tail)

Cons a new head onto the tail list.
def self.cons(head, tail)
  new(head, tail)
end

def self.empty

The standard empty list class for the given LinkedList class.
def self.empty
  self::EMPTY
end

def self.make(*args)

polymorphic
Make a list out of the given arguments. This method is
def self.make(*args)
  result = empty
  args.reverse_each do |item|
    result = cons(item, result)
  end
  result
end

def ==(other)

Lists are structurally equivalent.
def ==(other)
  current = self
  while ! current.empty? && ! other.empty?
    return false if current.head != other.head
    current = current.tail
    other = other.tail
  end
  current.empty? && other.empty?
end

def conj(item)

type of head node will be the same list type has the tail.
Polymorphically add a new element to the head of a list. The
def conj(item)
  self.class.cons(item, self)
end

def each

For each item in the list.
def each
  current = self
  while ! current.empty?
    yield(current.head)
    current = current.tail
  end
  self
end

def empty?

Is the list empty?
def empty?
  false
end

def initialize(head, tail=EMPTY)

def initialize(head, tail=EMPTY)
  @head = head
  @tail = tail
end

def inspect

Same as +to_s+, but with inspected items.
def inspect
  items = map { |item| item.inspect }.join(", ")
  "LL(#{items})"
end

def to_s

Convert to string: LL(item, item...)
def to_s
  items = map { |item| item.to_s }.join(", ")
  "LL(#{items})"
end