Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Mire: make current-room a ref

  • Loading branch information...
commit ce23a48946d7d3dfa4ddaed9d96d4304e4ed03d0 1 parent 9a09ab5
Andreas Pauley authored
4 PeepCode/Clojure/mire/src/mire.clj
... ... @@ -1,3 +1,5 @@
  1 +(add-classpath (str "file://" (.getParent (java.io.File. *file*)) "/"))
  2 +
1 3 (ns mire
2 4 (:use [mire commands rooms])
3 5 (:use [clojure.contrib server-socket duck-streams]))
@@ -15,7 +17,7 @@
15 17 ; Re-assign stdin and stdout
16 18 (binding [*in* (reader in)
17 19 *out* (writer out)
18   - *current-room* (rooms :start)]
  20 + *current-room* (ref (rooms :start))]
19 21 (println (look))
20 22 (print-prompt)
21 23 (loop [input (read-line)]
4 PeepCode/Clojure/mire/src/mire/rooms.clj
@@ -10,7 +10,7 @@
10 10
11 11 (defn current-room []
12 12 "Returns the current room"
13   - *current-room*)
  13 + @*current-room*)
14 14
15 15 (defn set-current-room [target]
16   - (set! *current-room* target))
  16 + (ref-set *current-room* target))

0 comments on commit ce23a48

Please sign in to comment.
Something went wrong with that request. Please try again.