diff options
-rw-r--r-- | tests/stdlib.lisp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/stdlib.lisp b/tests/stdlib.lisp index 86dabe2..88af2a1 100644 --- a/tests/stdlib.lisp +++ b/tests/stdlib.lisp @@ -6,11 +6,15 @@ (define or (x y) (if x 1 (if y 1 0))) (define and (x y) (if x (if y 1 0) 0)) +(define const (x) (lambda (_) x)) + (define != (x y) (not (= x y))) (define < (x y) (and (<= x y) (!= x y))) (define > (x y) (< y x)) (define >= (x y) (<= y x)) +(define . (f g) (lambda (x) (f (g x)))) + (define YY (recur) (lambda (f) (lambda (a) (f ((recur recur) f) a)))) (define Y (YY YY)) @@ -76,6 +80,12 @@ (define all (generic-list-string-2 "all" all-list all-str)) +(define reverse (l) + (let ((helper (lambdarec rec (l2 rest) + (if (null? l2) rest + (rec (cdr l2) (cons (car l2) rest)))))) + (helper l '()))) + (define stdin (sys-stdin)) (define stdout (sys-stdout)) (define stderr (sys-stderr)) |