-
-
Save Hendekagon/5f86fb9f38b715728e5a9c2394d5d5b7 to your computer and use it in GitHub Desktop.
Cyclic tag system in Clojure
This file contains 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
; t a list of productions, a an initial sequence | |
; note this halts with a NPE - it should really | |
; check for (empty? a) and reduced | |
(defn g [t a] | |
(reductions | |
(fn [[g & t] a] | |
(if (== 1 g) (concat t a) t)) | |
a (cycle t))) | |
(take 32 (g [[0 1 1] [1 1 1]] [1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment