Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use an atom instead of a ref for the entity ID generation.

closes #1
  • Loading branch information...
commit e792d4dc66fea6a9fb539f947d8010f3a33d7efd 1 parent 86aa2e4
Steve Losh authored
Showing with 2 additions and 5 deletions.
  1. +2 −5 src/caves/entities/core.clj
7 src/caves/entities/core.clj
View
@@ -1,7 +1,7 @@
(ns caves.entities.core)
-(def ids (ref 0))
+(def ids (atom 0))
(defprotocol Entity
(tick [this world]
@@ -9,10 +9,7 @@
(defn get-id []
- (dosync
- (let [id @ids]
- (alter ids inc)
- id)))
+ (swap! ids inc))
(defn make-fnmap
Please sign in to comment.
Something went wrong with that request. Please try again.