Skip to content

Instantly share code, notes, and snippets.

@shepmaster shepmaster/Backtrace
Created Sep 17, 2011

What would you like to do?
$ java -cp clojure.jar clojure.main ~/Projects/Clojure/fake-cs.clj
#<Agent@1f758500: {:name Music, :online false}>
Exception in thread "main" java.lang.NullPointerException (fake-cs.clj:0)
at clojure.lang.Compiler.eval(
at clojure.lang.Compiler.load(
at clojure.lang.Compiler.loadFile(
at clojure.main$load_script.invoke(main.clj:221)
at clojure.main$script_opt.invoke(main.clj:273)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(
at clojure.lang.Var.invoke(
at clojure.lang.AFn.applyToHelper(
at clojure.lang.Var.applyTo(
at clojure.main.main(
Caused by: java.lang.NullPointerException
at user$eval2$send_start__3.invoke(fake-cs.clj:16)
at user$eval2.invoke(fake-cs.clj:17)
at clojure.lang.Compiler.eval(
... 10 more
(def my-service (agent {:name "Music" :online false}))
(defn bring-online [service]
(service :online) (do
(println "Already started...")
:else (do
(println "Starting...")
(.. Thread (sleep 1000))
(assoc service :online (not (service :online))))))
(let [send-start #((println "Sending...")
(println my-service)
(send my-service bring-online))]
(println @my-service)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.