Class: Lisp::Environment

Inherits:
Atom show all
Defined in:
lib/rubylisp/environment.rb

Instance Attribute Summary

Attributes inherited from Atom

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Atom

#all?, #apply_to, #car, #cdr, #character?, #class?, #copy, #doc, #eof_object?, #eq?, #eqv?, #evaluate, #false?, #frame?, #function?, #length, #lisp_object?, #list?, #macro?, #negative?, #number?, #object?, #pair?, #port?, #positive?, #primitive?, #print_string, #quoted, #set!, #set_location, #special?, #string?, #symbol?, #to_s, #true?, #vector?, #zero?

Constructor Details

#initialize(e) ⇒ Environment

Returns a new instance of Environment.



9
10
11
# File 'lib/rubylisp/environment.rb', line 9

def initialize(e)
  @value = e
end

Class Method Details

.with_value(e) ⇒ Object



5
6
7
# File 'lib/rubylisp/environment.rb', line 5

def self.with_value(e)
  self.new(e)
end

Instance Method Details

#environment?Boolean

Returns:



13
14
15
# File 'lib/rubylisp/environment.rb', line 13

def environment?
  true
end

#equal?(other) ⇒ Boolean

Returns:



17
18
19
# File 'lib/rubylisp/environment.rb', line 17

def equal?(other)
  other.environment? && @value == other.value
end

#typeObject



21
22
23
# File 'lib/rubylisp/environment.rb', line 21

def type
  :environment
end