Module: SchemeBooleansHelper

Included in:
SchemeBooleans
Defined in:
lib/lisp/interpreter/core/boolean.rb

Overview

Scheme booleans helper

Instance Method Summary collapse

Instance Method Details

#if_helper(expr, other) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/lisp/interpreter/core/boolean.rb', line 13

def if_helper(expr, other)
  if expr == '#f'
    if_idx_helper other
  else
    other
  end
end

#if_idx_helper(other) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/lisp/interpreter/core/boolean.rb', line 3

def if_idx_helper(other)
  if other[0] == '('
    idx = find_bracket_idx other, 0
    other[idx + 1..-1]
  else
    _, other = find_next_value other
    other
  end
end