Advertisement
Guest User

Untitled

a guest
May 27th, 2021
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defparameter *possible-answers* '((P W Y B) (P B Y W)))
  2. (defun answer-status ()
  3.   (let ((counters '(((B . 0) (R . 0) (G . 0) (Y . 0) (P . 0) (W . 0))
  4.                ((B . 0) (R . 0) (G . 0) (Y . 0) (P . 0) (W . 0))
  5.                ((B . 0) (R . 0) (G . 0) (Y . 0) (P . 0) (W . 0))
  6.                ((B . 0) (R . 0) (G . 0) (Y . 0) (P . 0) (W . 0)))))
  7.   (loop with c = (copy-tree counters) for j from 0 to 3
  8.      do (loop for possible-answer in *possible-answers*
  9.        do (incf (cdr (assoc  (nth j possible-answer) (nth j c)))))
  10.      finally (format t "~{~{~8a~8a~8a~8a~8a~8a~}~%~}" c))))
  11.  
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement