More work on efficiency
This commit is contained in:
parent
1120cb42e8
commit
c96142a973
2 changed files with 11 additions and 3 deletions
|
|
@ -97,7 +97,7 @@
|
|||
(let [state {:world (transform-world world init-rules) :rules rules}]
|
||||
(:world
|
||||
(last
|
||||
(do-all
|
||||
(doall
|
||||
(take generations
|
||||
(iterate transform-world-state state)))))))
|
||||
|
||||
|
|
@ -109,5 +109,12 @@
|
|||
(dosync
|
||||
(ref-set r (transform-world (deref r) rules))))
|
||||
(deref r)))
|
||||
|
||||
(defn run-world3
|
||||
[world init-rules rules generations]
|
||||
(reduce (fn [world _iteration]
|
||||
(transform-world world rules))
|
||||
(transform-world world init-rules)
|
||||
(range generations)))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue