Import a namespace into the lane registry and access it

In the file, I can do this:

(:require [clojurewerkz.neocons.rest :as nr])

how can i import this into repl and still be able to reference it with 'nr'?

thanks

+1
source share
2 answers

Lee's answer is right, of course, but why do you need to quote? A vector [...]is evaluated and the values ​​inside also, and here clojurewerkz.neocons.rest, and are nrtreated as variables that are unrelated (you have an error message, right?). You can also specify the characters:

(require ['clojurewerkz.neocons.rest :as 'nr])

It also means that you could requirenamespaces dynamically if you pass a variable.

? , , (require ... ), , ns, . . require.

+3

require :

(require '[clojurewerkz.neocons.rest :as nr])
+1

Source: https://habr.com/ru/post/1614823/


All Articles