Permalink
Browse files

Mire: make current-room a ref

  • Loading branch information...
1 parent 9a09ab5 commit ce23a48946d7d3dfa4ddaed9d96d4304e4ed03d0 @apauley committed Dec 22, 2009
Showing with 5 additions and 3 deletions.
  1. +3 −1 PeepCode/Clojure/mire/src/mire.clj
  2. +2 −2 PeepCode/Clojure/mire/src/mire/rooms.clj
View
4 PeepCode/Clojure/mire/src/mire.clj
@@ -1,3 +1,5 @@
+(add-classpath (str "file://" (.getParent (java.io.File. *file*)) "/"))
+
(ns mire
(:use [mire commands rooms])
(:use [clojure.contrib server-socket duck-streams]))
@@ -15,7 +17,7 @@
; Re-assign stdin and stdout
(binding [*in* (reader in)
*out* (writer out)
- *current-room* (rooms :start)]
+ *current-room* (ref (rooms :start))]
(println (look))
(print-prompt)
(loop [input (read-line)]
View
4 PeepCode/Clojure/mire/src/mire/rooms.clj
@@ -10,7 +10,7 @@
(defn current-room []
"Returns the current room"
- *current-room*)
+ @*current-room*)
(defn set-current-room [target]
- (set! *current-room* target))
+ (ref-set *current-room* target))

0 comments on commit ce23a48

Please sign in to comment.