Created
December 8, 2012 13:36
-
-
Save thom4parisot/4240294 to your computer and use it in GitHub Desktop.
Game of Life in Clojure
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
| (defstruct cell :x :y :state) | |
| (defstruct state :state) | |
| (def state-alive (struct state "alive")) | |
| (def state-dead (struct state "dead")) | |
| (def cell1 (struct cell 13 37 state-alive)) | |
| (def grille [(struct cell 13 37 state-alive) (struct cell 13 38 state-alive) (struct cell 14 37 state-alive)]) | |
| (filter #(-> % :x (= 13)) grille) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment