lib/lisp/interpreter/core/boolean.rb in lisp-interpreter-0.5.4 vs lib/lisp/interpreter/core/boolean.rb in lisp-interpreter-0.5.5

- old
+ new

@@ -1,5 +1,7 @@ +require_relative 'stl_constants' + # Scheme booleans helper module SchemeBooleansHelper def if_idx_helper(other) if other[0] == '(' idx = find_bracket_idx other, 0 @@ -9,11 +11,11 @@ other end end def if_helper(expr, other) - if expr == '#f' + if expr == FALSE if_idx_helper other else other end end @@ -22,17 +24,17 @@ # Scheme booleans module module SchemeBooleans include SchemeBooleansHelper def equal?(other) raise arg_err_build 2, other.size if other.size != 2 - other[0].to_s == other[1].to_s ? '#t' : '#f' + other[0].to_s == other[1].to_s ? TRUE : FALSE end def not(other) raise arg_err_build 1, other.size if other.size != 1 valid = check_for_bool other[0] raise type_err '<boolean>', other[0].type unless valid - other[0] == '#t' ? '#f' : '#t' + other[0] == TRUE ? FALSE : TRUE end def if(other) raise arg_err_build 3, 0 if other.empty? expr, other = find_next_value other