Module: Prelude::ProperRubyList

Includes:
ProperList
Included in:
MinimalArrayList
Defined in:
lib/prelude/proper_ruby_list.rb

Overview

$Id: proper_ruby_list.rb 34 2007-10-23 21:38:09Z prelude $

Adds (but does not implement) 3 functions to a ProperList to make a well-behaved Ruby list.

Instance Method Summary collapse

Methods included from ProperList

#cons, #head, #null, #tail

Instance Method Details

#each(&block) ⇒ Object



43
44
45
# File 'lib/prelude/proper_ruby_list.rb', line 43

def each(&block)
  self.to_a.each(&block)
end

#initialize(a = nil) ⇒ Object

Raises:



35
36
37
# File 'lib/prelude/proper_ruby_list.rb', line 35

def initialize(a=nil)
  raise MissingMethodError.new("Method 'initialize' is not implemented by #{self.class.name}")
end

#to_aObject

Raises:



39
40
41
# File 'lib/prelude/proper_ruby_list.rb', line 39

def to_a
  raise MissingMethodError.new("Method 'to_a' is not implemented by #{self.class.name}")
end