Skip to content

Instantly share code, notes, and snippets.

@thom4parisot
Created December 8, 2012 13:36
Show Gist options
  • Select an option

  • Save thom4parisot/4240294 to your computer and use it in GitHub Desktop.

Select an option

Save thom4parisot/4240294 to your computer and use it in GitHub Desktop.
Game of Life in Clojure
(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