class Hamster::Sequence
The last Sequence
instance in the chain has the {EmptyList} as its tail.Sequence
.
each Sequence
holding a single element and a pointer to the next
rest of the list. This way a singly linked list can be constructed, with
the head
is an element in the list, and the tail
is a reference to the
A Sequence, also known as a “cons cell”, has a head
and a tail
, where
The basic building block for constructing lists
def empty?
def empty? false end
def initialize(head, tail = EmptyList)
def initialize(head, tail = EmptyList) @head = head @tail = tail end