aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-04-25 18:34:39 -0400
committerbnewbold <bnewbold@robocracy.org>2016-04-25 18:34:39 -0400
commitf3a7991a23253533818fa25a1b7012d4656eee0c (patch)
tree57d31696b9ddf5d4ce5fb0a2b724a330712b7550
parent8c3b966c1c85afb987cb4537812434fd98270148 (diff)
downloadspectrum-f3a7991a23253533818fa25a1b7012d4656eee0c.zip
spectrum-f3a7991a23253533818fa25a1b7012d4656eee0c.tar.gz
add basic 'prelude' file
-rw-r--r--prelude.scm24
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)))))