Skip to content

Instantly share code, notes, and snippets.

@MiLk
Created November 12, 2011 13:50
Show Gist options
  • Save MiLk/1360541 to your computer and use it in GitHub Desktop.
Save MiLk/1360541 to your computer and use it in GitHub Desktop.
(defun inverser (x)
(if (= x 1) 0 1)
)
(defun new-state(state pos)
(when (<= (length state) (+ pos 1)) (return-from new-state state))
(let ((i 0)(new-list '()))
(dolist (arrow state new-list)
(if (or (= i pos) (= i (+ pos 1)))
(setq new-list (append new-list (list (inverser arrow))))
(setq new-list (append new-list (list arrow)))
)
(setq i (+ i 1))
)
)
)
(new-state '(0 0 0 1 0 1) 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment