diff options
-rw-r--r-- | prelude.scm | 10 | ||||
l--------- | rust/prelude.scm | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/prelude.scm b/prelude.scm index 1a8d853..a3b123e 100644 --- a/prelude.scm +++ b/prelude.scm @@ -15,10 +15,18 @@ (define cddar (lambda (x) (car (cdr (cdr x))))) (define cdddr (lambda (x) (car (cdr (cdr x))))) +; my favorite! +(define cdaddr (lambda (x) (cdr (car (cdr (cdr x)))))) + (define if (lambda (pred tval fval) (cond (pred tval) (else fval)))) (define not (lambda (x) (if x #f #t))) (define abs (lambda (x) (if (> x 0) x (* -1 x)))) -;(define for-each map) +(define map + (lambda (f l) + (cond ((null? l) ()) + (else (cons (f (car l)) (map f (cdr l))))))) + +(define for-each map) ;(define compose (lambda (f g) (lambda args (f (apply g args))))) diff --git a/rust/prelude.scm b/rust/prelude.scm new file mode 120000 index 0000000..84e0834 --- /dev/null +++ b/rust/prelude.scm @@ -0,0 +1 @@ +../prelude.scm
\ No newline at end of file |