diff options
Diffstat (limited to 'loot.lsp')
-rw-r--r-- | loot.lsp | 92 |
1 files changed, 82 insertions, 10 deletions
diff --git a/loot.lsp b/loot.lsp index 727f8f3..857c7af 100644 --- a/loot.lsp +++ b/loot.lsp @@ -1,5 +1,5 @@ ;;; Port of https://en.wikipedia.org/wiki/ModernPascal#Code_Sample[3]. -;;; And then to CL. +;;; And then to CL and ISLisp. ;;; I prefer my version. (defconstant +max-probability+ 1000) ;; Because this is a simple enum and not a full sum/product type, @@ -15,11 +15,7 @@ (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. - ;; Also saves translating nil to "". - (case l + (setf (probabilities self) (vector 10 77 105 125 142 159 172 200 201 202 216 282 +max-probability+ (case l ((bloodstone) "Bloodstone") ((copper) "Copper") ((emeraldite) "Emeraldite") @@ -34,8 +30,84 @@ ((iron) "Iron") (t ""))) (defun main () - (let ((loot (create (class <looter>)))) - (for ((n 0 (+ n 1))) - ((> n 99)) + (let ((loot (create (class <looter>))) (for ((n 0 (+ n 1))) + + ((> n 99)) (format (standard-output) "~A~%" (as-string (choose loot)))))) -(main) + + +. /usr/local/plan9/bin/9.rc +if (test -d /usr/local/bin) { + path = (/usr/local/bin $path) +} +if (test -d /usr/local/opt/emacs-plus/bin) { + path = ($path /usr/local/opt/emacs-plus/bin) +} +if (test -d $home/bin) { + path = ($path $home/bin) +} +if (test -d $home/opt/GNAT/2020/bin) { + path = ($home/opt/GNAT/2020/bin $path) +} + +OPENLISP = $home/openlisp-11.0.0 +if (test -d $OPENLISP) { + path = ($path $OPENLISP) +} + +# These break some commands like man. +# Use the new names instead. +#fn grep { rg $* } +#fn ls { exa $* } +#fn find { fd $* } +#fn cat { bat $* } +#fn more { bat $* } +#fn xterm { alacritty $* } + +#prompt = ('$ ' '$ ') +REFER = $home/lsp/doc/refs + +if (test -d $home/.cargo/bin) { + path = ($home/.cargo/bin $path) +} + +if (test -d /usr/local/opt/tcl-tk/bin) { + path = (/usr/local/opt/tcl-tk/bin $path) +} + +if (test -d $home/obnc/usr/local/bin) { + path = ($path $home/obnc/usr/local/bin) +} + +if (test -d $home/.emacs.d/bin) { + path = ($path $home/.emacs.d/bin) +} +fn doom { u doom $* } +if (test -d /Applications/Emacs.app/Contents/MacOS/bin) { + path = ($path /Applications/Emacs.app/Contents/MacOS/bin) +} +if (test -f /Applications/Emacs.app/Contents/MacOS/Emacs) { + EMACS = /Applications/Emacs.app/Contents/MacOS/Emacs + fn emacs { u $EMACS -nw $* } +} +if (test -f /Applications/Emacs.app/Contents/MacOS/bin/emacsclient) { + fn emacsclient { u /Applications/Emacs.app/Contents/MacOS/bin/emacsclient $* } +} + +LANG = en_IE.UTF-8 +TZ = Europe/Dublin +LESS_IS_MORE = t +MORE = '-SEXIER' +POSIXLY_CORRECT = t +REFER = $home/lsp/doc/refs + +if (test -d $home/context/tex/texmf-osx-64/bin) { + path = ($path $home/context/tex/texmf-osx-64/bin) +} + +if (test -d $home/Library/Python/3.8/bin) { + path = ($path $home/Library/Python/3.8/bin) +} + +TCLLIBPATH = $home/lib/tklib0.7 + |