such.wide-domains

Variants of clojure.core functions that accept more types of inputs. This is a catch-all namespace that collects core-overriding functions from other namespaces. It has two purposes:

  • to show you all of such functions on one page of documentation.
  • to let you immigrate all of them in one swell foop.

See such.clojure.core for an example.

+find-var

(+find-var name)(+find-var ns name)

Return a variable identified by the arguments, or nil. A version of the built-in function, but with a wider domain.

Case 1: If the single argument is a namespace-qualified symbol, the behavior is the same as clojure.core/find-var: the variable of that name in that namespace is returned:

(+find-var 'clojure.core/even?) => #'clojure.core/even?

Note that the namespace must exist or an exception is thrown.

Strings with a single slash are treated as symbols:

(+find-var "clojure.core/even?") => #'clojure.core/even?

Namespace-qualified keywords can also be used.

Case 2: If the single argument is not namespace-qualified, it is treated as if it were qualified with *ns*:

(+find-var 'find-var) => #'this.namespace/find-var
(+find-var "symbol") => #'this.namespace/symbol

Case 3: If the single argument is a var, it is returned.

Case 4: In the two-argument case, the ns argument supplies the namespace and the name argument the var’s name. ns may be a namespace, symbol, keyword, or string (as-ns-symbol). name may be a string, symbol, keyword, or var. In the first three cases, the namespace part of name (if any) is ignored:

(+find-var 'such.wide-domains 'clojure.core/find-var) => #'such.wide-domains/find-var
(+find-var *ns* :find-var) => #'this.namespace/find-var

If the name argument is a var, find-var looks for a var with the same name in ns:

(+find-var 'such.wide-domains #'clojure.core/find-var) => #'such.wide-domains/find-var

+into

(+into coll & colls)

The result collection is formed by conjing all elements of the other colls onto coll (in order).

  (+into [] (map inc [1 2]) (map dec [-1 -2]))  => [2 3 -2 -3]

+into is a convenient way to coerce a number of collections into a vector or other collection of your choice.

Note: the Clojure 1.7 version of into has a three argument version that takes a transducer as its second argument. Unlike in 1.6 and earlier, +into is not a compatible replacement for 1.7’s into.

+symbol

(+symbol name)(+symbol ns name)

Creates a symbol. A variant of the clojure.core version with a wider domain.
The ns argument may be a namespace, symbol, keyword, or string (as-ns-string).
The name argument may be a symbol, string, keyword, or var (as-string-without-namespace).

In the one-argument version, the resulting symbol has a nil namespace. In the two-argument version, it has the symbol version of ns as the namespace. Note that ns need not refer to an existing namespace.

(+symbol "th") => 'th
(+symbol 'clojure.core "th") => 'clojure.core/th

(+symbol *ns* 'th) => 'this.namespace/th ; "add" a namespace
(+symbol *ns* 'clojure.core/even?) => 'this.namespace/even? ; "localize" a symbol.