Class: Skeem::SkmVariableReference

Inherits:
SkmUnaryExpression show all
Defined in:
lib/skeem/skm_unary_expression.rb

Overview

class

Instance Attribute Summary

Attributes inherited from SkmUnaryExpression

#child

Attributes inherited from SkmElement

#position

Instance Method Summary collapse

Methods inherited from SkmUnaryExpression

#accept, #initialize

Methods inherited from SkmElement

#accept, #boolean?, #bound!, #callable?, #char?, #complex?, #done!, #initialize, #inspect, #integer?, #list?, #null?, #number?, #pair?, #procedure?, #quoted!, #rational?, #real?, #skm_eq?, #skm_equal?, #string?, #symbol?, #unquoted!, #vector?, #verbatim?

Constructor Details

This class inherits a constructor from Skeem::SkmUnaryExpression

Instance Method Details

#eqv?(other) ⇒ Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/skeem/skm_unary_expression.rb', line 92

def eqv?(other)
  child == other.child
end

#evaluate(aRuntime) ⇒ Object



96
97
98
99
100
# File 'lib/skeem/skm_unary_expression.rb', line 96

def evaluate(aRuntime)
  var_key = variable.evaluate(aRuntime)
  # $stderr.puts "Variable #{variable.inspect}"
  aRuntime.evaluate(var_key)
end

#quasiquote(_runtime) ⇒ Object



102
103
104
# File 'lib/skeem/skm_unary_expression.rb', line 102

def quasiquote(_runtime)
  self
end

#valueObject

Confusing! Value, here, means the value of the identifier (the variable's name).



108
109
110
# File 'lib/skeem/skm_unary_expression.rb', line 108

def value
  variable.value
end