;; add this code in eval
((unless? expr)(eval(unless->if expr) env));; unless expression is very similar to if expression.
(define(unless? expr)(tagged-list? expr 'unless))(define(unless-predicate expr)(cadr expr))(define(unless-consequnce expr)(if(not(null?(cdddr expr)))(cadddr expr)'false))(define(unless-alternative expr)(caddr expr))(define(unless->if expr)(make-if (unless-predicate expr)(unless-consequence expr)(unless-alternative expr)))
First I should note that my implementation (same as meteorgan's above) does not even work for the lazy factorial procedure...it aborts due to infinite recursion. As for actual higher order procedures here's a very clever example borrowed from Xueqiao Xu, binary pattern matching:
SophiaG
First I should note that my implementation (same as meteorgan's above) does not even work for the lazy factorial procedure...it aborts due to infinite recursion. As for actual higher order procedures here's a very clever example borrowed from Xueqiao Xu, binary pattern matching:
Richard
It actually works well with the factorial procedure in my implementation.