tisp

tiny lisp
git clone git://edryd.org/tisp
Log | Files | Refs | LICENSE

commit 6b3cf4de18170e95508c2ad8a33e2265abaf4e72
parent 3a39473fd92343a88badad72859a1096b0aa6794
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Tue, 24 Sep 2019 23:16:26 -0700

Add zip function to create a list of pairs

Diffstat:
tibs/lib.tsp | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -126,6 +126,12 @@ ((= key (caar table)) (car table)) (else (assoc key (cdr table))))) +(define (zip x y) + (cond ((and (nil? x) (nil? y)) nil) + ((and (pair? x) (pair? y)) + (cons (cons (car x) (car y)) + (zip (cdr x) (cdr y)))))) + (define (member? mem lst) (cond ((nil? lst) ()) ((= mem (car lst)) t)