Reputation: 311
If I begin a program with
(ns dailyprogrammer.core
(:gen-class)
(:require [dailyprogrammer.other :refer :all]))
and then later on attempt to resolve a function hello
which is defined inside other
using resolve
or ns-resolve
like so:
(resolve (symbol "hello"))
(ns-resolve *ns* (symbol "hello"))
I get nil returned. But I can simply call
(hello)
which will work. Why can't I use either resolve function?
Upvotes: 1
Views: 162
Reputation: 20194
ns-resolve
does not look up symbols visible in *ns*
, it looks up symbols that are defined in *ns*
. :refer :all
makes all symbols from the other ns visible in your definitions, it does not move or replicate their vars into your ns.
Upvotes: 4