+
+ ;
+ ; A slightly more convenient form
+ ; for defining lambdas.
+ ;
+ ; (defun <name> (<params>) s-exprs)
+ ;
+
+(def defun (macro (defun-param)
+ (let ((name (car defun-param))
+ (args (cadr defun-param))
+ (exprs (cdr (cdr defun-param))))
+ (list
+ def
+ name
+ (list
+ 'lambda
+ args
+ (cond ((cdr exprs)
+ (cons progn exprs))
+ ((car exprs))
+ )
+ )
+ )
+ )
+ )
+ )
+
+ ; simple math operators
+ ;
+ ; Do these last to run defun
+ ; at least once so the let macro
+ ; is resolved
+
+(defun 1+ (x) (+ x 1))
+(defun 1- (x) (- x 1))