Skip to content

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

@poppingtonic

Description

@poppingtonic

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions