A moonew language for itneraction.


So, in lisp we like to write new languages until we don't have to write lisp any more, at which point we are done writing lisp.

My last nightmare devlog was basically that. What I wanted to happen (broooadly) was happening, but it was unnatural to write. So I wrote

(defun mooread (s c) (declare (ignore c))
          (let ((list (loop
                       :collecting
                        (handler-case (read s t nil t)
                         (end-of-file () (return vals)))
                       :into vals)))
                           (append (list 'verb-plist
                    :verb `(quote ,(intern (format nil "~@{~a~^-~}" 'com
                                    (symbol-name (car list)))))
                    :dobj `(quote ,(cadr list))
                    :prep `(quote ,(caddr list))
                    :iobj `(quote ,(cadddr list)))
                   (nthcdr 4 list))))
(set-macro-character #\{ #'mooread)

Clumsy but explicit! After which I can

{ @create $object :named sandwich

instead of

(verb-plist :verb 'com-@create :dobj '$object :prep ':named :iobj 'sandwich)

but they are equivalent. The former is simply a language for creating the latter.

Further keys can be explicitly specified, but their values are evaluated since I imagine they might come from variables.

{ @create $object :named sandwich :caller 'screwtape

Well, I thought it fixed the ugliness from last time. The other underlying issue is that the way command tables are populated is traumatic for the lisp compiler, but that issue is outside the scope of the jam.

Tomorrow I should be able to finish jamming, simply by writing these lovely { readchar extended mooese and little or nothing else.

Get lispmoo2

Leave a comment

Log in with itch.io to leave a comment.