clarify different link functions in clojure
A great useful tutorial and I am there to make this summary.
refer takes a symbol argument and maps all the public symbols from that namespace into the current namespace.
The symbols are still mapped to the values in their original namespace. By calling refer in the example, you created a namespace mapping from the symbol
greetings/println to the Var
To link another class/function with our namespace, but its own namespace kept. Needs canonical namespace to invoke. Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly.
As you need to use
namespace/function to refer to target function.
To import another class/function into our namespace, hence target namespace just like
merged into your namespace.
This function combined
refer. But for recent version, they tend to deprecated
use by using
(require '[clojure.data.json :refer :all]).
You just need to use
function to refer to target function directly without referring namespace.
Java class into namespace and shorten the invock name.
You could shorten the canonical name and just need to use simple name of a
class to refer to target class
To simply those kinds of link function, use
(ns) function to bring them all together.
You could use random quantity of any
:import in this function.
An original innovated prime number function: