diff options
1 files changed, 24 insertions, 0 deletions
diff --git a/prelude.scm b/prelude.scm
new file mode 100644
index 0000000..1a8d853
--- /dev/null
+++ b/prelude.scm
@@ -0,0 +1,24 @@
+; This file contains Scheme/LISP helpers that are intended to be loaded into a
+; base environment before execution begins.
+(define caar (lambda (x) (car (car x))))
+(define cadr (lambda (x) (car (cdr x))))
+(define cdar (lambda (x) (cdr (car x))))
+(define cddr (lambda (x) (cdr (cdr x))))
+(define caaar (lambda (x) (car (car (car x)))))
+(define caadr (lambda (x) (car (car (car x)))))
+(define cadar (lambda (x) (car (car (car x)))))
+(define caddr (lambda (x) (car (car (car x)))))
+(define cdaar (lambda (x) (car (car (car x)))))
+(define cdadr (lambda (x) (car (cdr (cdr x)))))
+(define cddar (lambda (x) (car (cdr (cdr x)))))
+(define cdddr (lambda (x) (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 compose (lambda (f g) (lambda args (f (apply g args)))))