Add low-level class support, stub of high level OOP wrapper
diff --git a/lib/lisp/std/list-functions.lisp b/lib/lisp/std/list-functions.lisp
index f25ceb5..bba2835 100644
--- a/lib/lisp/std/list-functions.lisp
+++ b/lib/lisp/std/list-functions.lisp
@@ -34,3 +34,16 @@
(reduce fun (cdr list)
(funcall fun initial-value
(car list)))))
+
+(defmacro dolist (bind & body)
+ "(dolist (var list) body ...)"
+ (let ((var (car bind))
+ (list (cadr bind))
+ (rest-sym (gensym)))
+ `(funcall
+ (lambda (,rest-sym)
+ (let ((,var (car ,rest-sym)))
+ (progn ,@body)
+ (if (cdr ,rest-sym)
+ (recurse (cdr ,rest-sym)))))
+ ,list)))
diff --git a/lib/lisp/std/oop.lisp b/lib/lisp/std/oop.lisp
new file mode 100644
index 0000000..fd9bc1b
--- /dev/null
+++ b/lib/lisp/std/oop.lisp
@@ -0,0 +1,11 @@
+;;; oop.lisp
+
+;; TODO
+(defmacro defclass (name members)
+ "(defclass person (name age (occupation nil)))"
+ (let ((makefn-name (string->symbol (concat "make-" (symbol->string name))))
+ (class-sym (gensym))
+ (nmemb (length members)))
+ `(defun ,makefn-name ,members
+ (let ((,class-sym (make-class ,name ,nmemb)))
+ ,class-sym))))
diff --git a/lib/lisp/std/std.lisp b/lib/lisp/std/std.lisp
index a199516..dfd70a2 100644
--- a/lib/lisp/std/std.lisp
+++ b/lib/lisp/std/std.lisp
@@ -71,3 +71,4 @@
(funcall let- bindings body))
(load "list-functions.lisp")
+(load "oop.lisp")