Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompilerException when I use a/mk-arms (first usage) #1

Open
poppingtonic opened this issue Nov 30, 2013 · 1 comment
Open

CompilerException when I use a/mk-arms (first usage) #1

poppingtonic opened this issue Nov 30, 2013 · 1 comment

Comments

@poppingtonic
Copy link

Hi,
Running the first code snippet in README.md, I (ahem) ran into a little hitch.
I entered the forms in a leiningen 2.3.4 repl.

user=> (ns mybandit.core)
nil
mybandit.core=> (load "core")

And got the response:

CompilerException java.lang.RuntimeException: No such var: a/mk-arms, compiling:(mybandit/core.clj:9:11) 

In my core.clj, I had:

(ns mybandit.core 
(:require 
[clj-bandit.arms :as a] 
[clj-bandit.algo.epsilon :as e]))

...

;; the rest of the code in README.md

If I repeat the actions in a repl, as opposed to loading core.clj, the call a/mk-arms causes the same runtime exception as above.

(def arms 
(a/mk-arms :arm1 :arm2 :arm3 :arm4 :arm5))

I replaced it with the exact same implementation of mk-arms in arms.clj

;; in core.clj, right after the namespace definition.
(defn mk-arms [& names] 
 (apply sorted-map (interleave names (map a/mk-arm names))))

(def arms (mk-arms :arm1 :arm2 :arm3 :arm4 :arm5))
...

Which, when ran like this, works well just as the recipe describes. Have you seen this issue anywhere else?

@pingles
Copy link
Owner

pingles commented Dec 4, 2013

Hi,

That's strange. I've just tried it myself and it seems ok (albeit running a repl inside the bandit-core project):

$ lein repl
nREPL server started on port 54133 on host 127.0.0.1
REPL-y 0.2.1
Clojure 1.5.1
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)

user=> (ns casino.wynn
  #_=>   (:require [clj-bandit.arms :as a]
  #_=>             [clj-bandit.algo.epsilon :as e]))
nil
casino.wynn=> (a/mk-arms :arm1 :arm2 :arm3 :arm4 :arm5)
{:arm1 #clj_bandit.arms.Arm{:name :arm1, :pulls 0, :value 0}, :arm2 #clj_bandit.arms.Arm{:name :arm2, :pulls 0, :value 0}, :arm3 #clj_bandit.arms.Arm{:name :arm3, :pulls 0, :value 0}, :arm4 #clj_bandit.arms.Arm{:name :arm4, :pulls 0, :value 0}, :arm5 #clj_bandit.arms.Arm{:name :arm5, :pulls 0, :value 0}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants