commit 8043c65788a09f6d2f4d907e138007ffb8d563c4
parent e6ad750f215fa48f4aa0ae09fc41d962683bd580
Author: Ed van Bruggen <edvb@uw.edu>
Date: Wed, 9 Oct 2019 23:49:28 -0700
Add list reverse function
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/tibs/lib.tsp b/tibs/lib.tsp
@@ -111,6 +111,12 @@
(f (cdr lst) (+ x 1))
x)))
+(define (reverse l)
+ (recur f ((in l) (out nil))
+ (if (pair? in)
+ (f (cdr in) (cons (car in) out))
+ out)))
+
(define (apply fn args)
(eval (map (lambda (x)
(list 'quote x))