#+RESULTS:
: *CAL*
** Events
and that events could be 3 letter ANSI graphic char symbols.
The tricky thing is that I thought they should be interned in a different package.
*** event package
#+begin_src lisp
(defvar *cal-event-pkg* (uiop:ensure-package :|scr|))
#+end_src
*** events and event naming
Since one might want to compare lots and lots of events at once,
I'm going to use 3 letter ansi graphic char names per event, but
put an event class in the symbol-value
#+RESULTS:
: #<PACKAGE "WEK">
*** Add days with events
#+begin_src lisp
(loop for day in '(mon tue wed thu fri sat sun)
for sym = (car (add-event day))
for evn = (make-instance 'calendar-event)
do (set sym evn)
finally
(setf *cal* (nreverse *cal*))
(return *cal*))
#+end_src
#+RESULTS:
: #<#<CALENDAR-EVENT {1001DE7A93}>
: Subevents: (BOSH BASH BISH)
: Notes:
: multi
: line
: some other note
: some-note
*** Save cal to var and look at a day
#+begin_src lisp
(defparameter *wek* *cal*)
(list (second *wek*) (symbol-value (second *wek*)))
#+end_src
#+RESULTS:
: (WEK::TUE #<#<CALENDAR-EVENT {1001DE7A93}>
: Subevents: (BOSH BASH BISH)
: Notes:
: multi
: line
: some other note
: some-note)
*** Actually, I really want to get the unreadable print as a padded list of lines.
#+begin_src lisp :results verbatim output
(defmethod list-unreadable ((obj calendar-event) &optional (padded-to 32))
(with-input-from-string
(in (with-output-to-string (*standard-output*)
(princ obj)))
(loop for line = (read-line in nil nil)
for padded = (format nil "~vA" padded-to line)
while line collect padded)))
(let ((summary (list-unreadable wek::tue)))
(format t "~{~s~^~%~}" summary))
#+end_src
*** Create goban year calendar
#+begin_src lisp
(loop
initially (setf *cal-event-pkg* (uiop:ensure-package :l19))
for row below 19
for letter in '(a b c d e f g h j k l m n o p q r s t)
for str = (format nil "_~a:" letter)
collect
(car (Add-event str)) into tmp
do
(set (car (last tmp))
(make-instance
'calendar-event
:subevents
(loop
initially (setq *cal* '())
for col below 19
for flat = (+ col (* 19 row) 1)
for pad = (format nil "~3,'0d" flat)
for sym = (car (add-event pad))
do
(set sym (make-instance 'calendar-event))
finally (return (nreverse *cal*)))))
finally (setq *cal* tmp))
(defvar *l19*)
(setq *l19* (make-instance 'calendar-event :subevents *cal*))
(setq *cal* nil)