about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDarren Bane <darren.bane@gmail.com>2021-01-17 23:11:50 +0000
committerDarren Bane <darren.bane@gmail.com>2021-01-17 23:11:50 +0000
commite8cd4c31932ee50b72875591ca61730512280fbe (patch)
treedad072625dfaaf4a344b7a6e3af4323151b4c22c
parentec33fa3c80f852d60d7e2fcd046cc49c08fad803 (diff)
downloadlsp-e8cd4c31932ee50b72875591ca61730512280fbe.tar.gz
Remove CL-isms from loot.lsp for testing eisl, which works well now
-rw-r--r--loot.lsp16
1 files changed, 8 insertions, 8 deletions
diff --git a/loot.lsp b/loot.lsp
index 6192dbf..727f8f3 100644
--- a/loot.lsp
+++ b/loot.lsp
@@ -5,16 +5,16 @@
 ;; Because this is a simple enum and not a full sum/product type,
 ;; I use symbols instead of CLOS.
 (defconstant +loot-type+ (vector 'bloodstone 'copper 'emeraldite 'gold
-                           'heronite 'platinum 'shadownite 'silver
+                           'heronite 'platinum 'shaownite 'silver
                            'soranite 'umbrarite 'cobalt 'iron
                            'nothing))
 (defclass <looter> () ((probabilities :accessor probabilities)))
 (defgeneric choose (self))
 (defmethod choose ((self <looter>))
   (let ((random-value (random (- +max-probability+ 1))))
-    (do ((loop 0 (+ loop 1)))
-        ((>= (elt (probabilities self) (mod loop 13)) random-value) (elt +loot-type+ (mod loop 13))))))
-(defmethod initialize-instance :after ((self <looter>) &rest initargs)
+    (for ((loop 0 (+ loop 1)))
+	((>= (elt (probabilities self) (mod loop 13)) random-value) (elt +loot-type+ (mod loop 13))))))
+(defmethod initialize-object :after ((self <looter>) initargs)
   (setf (probabilities self) (vector 10 77 105 125 142 159 172 200 201 202 216 282 +max-probability+)))
 (defun as-string (l)
   ;; Could use assoc here, but this is closer to the original.
@@ -34,8 +34,8 @@
     ((iron) "Iron")
     (t "")))
 (defun main ()
-  (let ((loot (make-instance (find-class '<looter>))))
-    (do ((n 0 (+ n 1)))
-      ((> n 99))
-      (format *standard-output* "~A~%" (as-string (choose loot))))))
+  (let ((loot (create (class <looter>))))
+    (for ((n 0 (+ n 1)))
+	((> n 99))
+	(format (standard-output) "~A~%" (as-string (choose loot))))))
 (main)