screwlisp proposes kittens

Chinese Chess Console Common Lisp Interface Manager Class pt I : A board class is conveyed

Sorry about the fallow days everyone, my housemates were a bit dramatic for me to be able to write and think the last couple days. I will try strictly writing at a cafe starting tomorrow.

However, here is a bit of code that was part of my experience report that got rejected from the european lisp symposium solely by this reviewer:

I would be delighted to find cases where the wisdom of my coding years were proven wrong, and be initiated to a broader wisdom.

(What higher praise can there be).

The broader theme of the report was Gabriellian mixin oriented programming in which the behaviour of mixins was implicitly sensitive to what they were mixing in to.

Centrally, I write a generic convey whose behaviour meaningfully changes depending on how and where its defining classes mix it in.

This was a gui app I wrote for a library club in a language I told them was called Hsiang-wu lisp (if the vote had been less cowardly, the evolution of lisp reads).

I am of course heavily using emacs eev-mode to literate-coding-ify and automate and hyperlink this markdown document I’m pasting code into.

Setup emacs eev with sbcl and mcclim.

#|
 (eepitch-sbcl)
 (eepitch-kill)
 (eepitch-sbcl)
|#
(asdf:load-system :mcclim)
(in-package :clim-user)

A board sequence mixin and conveyance at all!

Theory. Xiangqi three parts.0. Mixin terminal xiangqi game

  1. CLIM app with display and move command
  2. ASCII Xiangqi move notation parsing
  3. With the CLIM movement

The affectation is going to be /repl/ interactions, hopping on stones across a pond.

(I guess I talk to myself like this while programming).

;;; generic reflecting symmetries within an eventual clim display-function.
(defgeneric convey
    (obj &optional stream)
  (:documentation "conveys thing from table in some sense"))

;;; Ten ranks of "empty intersection" + symbols.
(defclass empty-board
    ()
  ((board :initarg :board :reader board))
  (:default-initargs
   :board (loop
	    :repeat 10
	    :collect '(+ + + + + + + + +))))

(defclass gets-board-mixin () ())

(defmethod convey
    ((obj gets-board-mixin) &optional stream)
  (declare (ignore stream))
  (with-slots
	(board)
      obj
    (values board)))
#|
(defclass %conveys
    (gets-board-mixin empty-board)
  ())

(convey (make-instance '%conveys))
|#

Console / repl output (from eev)!

* (asdf:load-system :mcclim)
T
* (in-package :clim-user)
#<PACKAGE "CLIM-USER">
* (defgeneric convey
    (obj &optional stream)
  (:documentation "conveys thing from table in some sense"))
#<STANDARD-GENERIC-FUNCTION CLIM-USER::CONVEY (0)>
* (defclass empty-board
    ()
  ((board :initarg :board :reader board))
  (:Default-initargs
   :board (loop
	    :repeat 10
	    :collect '(+ + + + + + + + +))))
#<STANDARD-CLASS CLIM-USER::EMPTY-BOARD>
* (defclass gets-board-mixin () ())
#<STANDARD-CLASS CLIM-USER::GETS-BOARD-MIXIN>
* (defmethod convey
    ((obj gets-board-mixin) &optional stream)
  (declare (ignore stream))
  (with-slots
	(board)
      obj
    (values board)))
#<STANDARD-METHOD CLIM-USER::CONVEY (GETS-BOARD-MIXIN) {1006AB11C3}>
* (defclass %conveys
    (gets-board-mixin empty-board)
  ())
#<STANDARD-CLASS CLIM-USER::%CONVEYS>
* (convey (make-instance '%conveys))
((+ + + + + + + + +) (+ + + + + + + + +) (+ + + + + + + + +)
 (+ + + + + + + + +) (+ + + + + + + + +) (+ + + + + + + + +)
 (+ + + + + + + + +) (+ + + + + + + + +) (+ + + + + + + + +)
 (+ + + + + + + + +))
* 

Conclusions

This example does fine to show defclass being used at all. convey on empty-board currently just provides a reader method with an optional unused stream arguement. We can look forward to things getting weirder.

Fin.

Please share the part one tiny example article in any and every way that pleases you, at least to let people know I did not in fact softly and silently vanish away, never to be heard from again.

Looking forward to hearing from you on the Mastodon about it! The rejecting reviewer is of course welcome on the lispy gopher climate.

screwlisp proposes kittens