Last active
December 18, 2015 09:29
-
-
Save PuercoPop/5761645 to your computer and use it in GitHub Desktop.
Why does setf (top-left board) fails?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :cl-user) | |
;;; Everything now works thanks to Bike and http://stackoverflow.com/questions/11457071/defining-setf-expanders-in-common-lisp | |
;;; Learned something new today | |
(defun top-center (board) | |
(car (cdr board))) | |
(defun (setf top-center) (value board) | |
(setf (car (cdr board)) value)) | |
(let ((board (list :1 :2 :3 :4)) | |
(player :empty)) | |
(format t "Board: ~A~%" board) | |
(setf (top-center board) player) | |
(format t "Board: ~A~%" board)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment