Module: SchemeBooleans
Overview
Instance Method Summary
collapse
#if_helper, #if_idx_helper
Instance Method Details
#equal?(other) ⇒ Boolean
25
26
27
28
|
# File 'lib/lisp/interpreter/boolean.rb', line 25
def equal?(other)
raise 'Incorrect number of arguments' if other.size != 2
other[0].to_s == other[1].to_s ? '#t' : '#f'
end
|
#if(other) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/lisp/interpreter/boolean.rb', line 36
def if(other)
raise 'Incorrect number of arguments' if other.empty?
expr, other = find_next_value other
raise 'Incorrect number of arguments' if other.empty?
if_helper expr, other
end
|
#not(other) ⇒ Object
30
31
32
33
34
|
# File 'lib/lisp/interpreter/boolean.rb', line 30
def not(other)
raise 'Incorrect number of arguments' if other.size != 1
raise 'Invalid data type' unless check_for_bool other[0]
other[0] == '#t' ? '#f' : '#t'
end
|