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

Repl namespace issue #146

Open
rr326 opened this issue Aug 31, 2019 · 1 comment
Open

Repl namespace issue #146

rr326 opened this issue Aug 31, 2019 · 1 comment

Comments

@rr326
Copy link

rr326 commented Aug 31, 2019

Something is wrong in the namespace setup (I think).

--> lein repl
nREPL server started on port 49447 on host 127.0.0.1 - nrepl://127.0.0.1:49447
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_121-b13
    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)
 Results: Stored in vars *1, *2, *3, an exception in *e

koan-engine.runner=> (string/join '(1 2 3))
Syntax error compiling at (form-init1178655580028819709.clj:1:1).
No such namespace: string

The koans themselves run successfully. This is MacOS. Sorry if I'm doing something dumb.

@trptcolin
Copy link
Member

trptcolin commented Sep 2, 2019

Yeah, I can see why that's confusing. Here's a short-term fix for you:

koan-engine.runner=> (clojure.string/join '(1 2 3))
"123"

...or...

koan-engine.runner=> (require '[clojure.string :as string])
nil
koan-engine.runner=> (string/join '(1 2 3))
"123"

See https://8thlight.com/blog/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html for more detail.

I think there are probably improvements we can make to the koans in order to make it clearer what's going on with namespaces, so I'll leave this open as a reminder (and in case anyone wants to tackle it!)

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

No branches or pull requests

2 participants