tisp

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

commit 5c1bba0d331b21889513e708c6bdfdd0b8dc9757
parent 87eddd9dc1c7b6987e2e67e14baca56862786c40
Author: Ed van Bruggen <edvb@uw.edu>
Date:   Fri,  4 Oct 2019 17:03:13 -0700

Add list length function

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

diff --git a/tibs/lib.tsp b/tibs/lib.tsp @@ -105,6 +105,12 @@ (car lst) (nth (- i 1) (cdr lst))))) +(define (length lst) + (recur f ((lst lst) (x 0)) + (if lst + (f (cdr lst) (+ x 1)) + x))) + (define (apply fn args) (eval (map (lambda (x) (list 'quote x))