Module: Algebrick::Types::LinkedList

Includes:
Enumerable
Defined in:
lib/algebrick/types.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) empty



52
53
54
# File 'lib/algebrick/types.rb', line 52

def self.empty
  LinkedListEmpty
end

Instance Method Details

- (Object) each(&block)



43
44
45
46
47
48
49
50
# File 'lib/algebrick/types.rb', line 43

def each(&block)
  it = self
  loop do
    break if LinkedListEmpty === it
    block.call it.value
    it = it.next
  end
end