commit 87eddd9dc1c7b6987e2e67e14baca56862786c40
parent 9144fd2fb359c694cf8a1e810e2c3470c4045f84
Author: Ed van Bruggen <edvb@uw.edu>
Date: Fri, 4 Oct 2019 17:01:48 -0700
Add recur macro to do local recursion
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/tibs/lib.tsp b/tibs/lib.tsp
@@ -65,6 +65,9 @@
(define let
(macro (vars body)
(cons (list 'lambda (map car vars) body) (map cadr vars))))
+(define recur
+ (macro (fn vars body)
+ (cons (list 'lambda (cons fn (map car vars)) body) (cons (list 'lambda (map car vars) body) (map cadr vars)))))
;;; Logic
(define (not x)