Commits

David Jones  committed 00e10a7

initial files.

  • Participants

Comments (0)

Files changed (2)

File lisp/basic-math.lisp

+
+;; (gcd &rest integers)
+;; (lcm &rest integers)
+
+
+(defun factorial (m)
+  (if (< m 2)
+      1
+      (* m (factorial (- m 1)))))
+
+(defun factorial-2 (m)
+  (if (< m 2) 
+      1
+      (do* ((i 1 (+ 1 i))
+            (acc 1 (* acc i)))
+           ((= i m) acc))))
+
+
+         
+(defun combinations (m n)
+  "Calculate M choose N.  

File lisp/utilities.lisp

+
+;; Various utility functions and macros
+
+(defmacro while (test &rest body)
+  "from ANSI Common Lisp by Graham."
+  `(do ()
+       ((not ,test))
+     ,@body))