examples/bool_expr/bool_expr.rb in sexpr-0.4.0 vs examples/bool_expr/bool_expr.rb in sexpr-0.5.0
- old
+ new
@@ -40,12 +40,12 @@
# The main rewriting rule, that pushes a NOT according to the different
# cases
def on_bool_not(sexpr)
case expr = sexpr.last
- when And then call [:bool_or, [:bool_not, expr[1]], [:bool_not, expr[2]] ]
- when Or then call [:bool_and, [:bool_not, expr[1]], [:bool_not, expr[2]] ]
- when Not then call expr.last
+ when And then apply [:bool_or, [:bool_not, expr[1]], [:bool_not, expr[2]] ]
+ when Or then apply [:bool_and, [:bool_not, expr[1]], [:bool_not, expr[2]] ]
+ when Not then apply expr.last
when Lit then [:bool_lit, !expr.last]
else
sexpr
end
end
\ No newline at end of file