Class: Ruspea::Runtime::Nill
- Inherits:
-
Object
- Object
- Ruspea::Runtime::Nill
- Includes:
- Singleton
- Defined in:
- lib/ruspea/runtime/nill.rb
Constant Summary collapse
- ARRAY =
[].freeze
Instance Method Summary collapse
- #==(other) ⇒ Object
- #car ⇒ Object
- #cdr ⇒ Object
- #cons(el) ⇒ Object
- #count ⇒ Object
- #empty? ⇒ Boolean
- #eq?(other) ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #head ⇒ Object
- #tail ⇒ Object
- #to_a(*_) ⇒ Object
Instance Method Details
#==(other) ⇒ Object
49 50 51 52 |
# File 'lib/ruspea/runtime/nill.rb', line 49 def ==(other) return true if other.is_a? Nill false end |
#car ⇒ Object
13 14 15 |
# File 'lib/ruspea/runtime/nill.rb', line 13 def car nil end |
#cdr ⇒ Object
21 22 23 |
# File 'lib/ruspea/runtime/nill.rb', line 21 def cdr self end |
#cons(el) ⇒ Object
29 30 31 |
# File 'lib/ruspea/runtime/nill.rb', line 29 def cons(el) return List.new(el, self, count: 1) end |
#count ⇒ Object
25 26 27 |
# File 'lib/ruspea/runtime/nill.rb', line 25 def count 0 end |
#empty? ⇒ Boolean
33 34 35 |
# File 'lib/ruspea/runtime/nill.rb', line 33 def empty? true end |
#eq?(other) ⇒ Boolean
41 42 43 |
# File 'lib/ruspea/runtime/nill.rb', line 41 def eq?(other) self == other end |
#eql?(other) ⇒ Boolean
45 46 47 |
# File 'lib/ruspea/runtime/nill.rb', line 45 def eql?(other) self == other end |
#head ⇒ Object
9 10 11 |
# File 'lib/ruspea/runtime/nill.rb', line 9 def head nil end |
#tail ⇒ Object
17 18 19 |
# File 'lib/ruspea/runtime/nill.rb', line 17 def tail self end |
#to_a(*_) ⇒ Object
37 38 39 |
# File 'lib/ruspea/runtime/nill.rb', line 37 def to_a(*_) ARRAY end |