Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; src/net/foo.clj
- (ns net.foo)
- (defn start-server []
- (println "Server started!"))
- (defprotocol IFoo
- (start [_]))
- (defrecord Foo []
- IFoo
- (start [_]
- (start-server)))
- ;; usage example
- Foo f = new Foo();
- f.start();
- ;; exception
- Exception in thread "main" java.lang.IllegalStateException: Var hypernet.foo/start-server is unbound.
- at clojure.lang.Var.deref(Var.java:142)
- at clojure.lang.Var.get(Var.java:133)
- at hypernet.foo.Foo.start(foo.clj:12)
- at hypernet.test.HyperTest.<init>(HyperTest.java:10)
- at hypernet.test.HyperTest.main(HyperTest.java:31)
Advertisement
Add Comment
Please, Sign In to add comment