Define and instantiate thingys.
Define and instantiate thingys.
(defn-thingy name doc-string attr-map args body)
Defines a thingy function by binding name
to body
and assigns it to
all instances. Analagous to defn
, but requires a doc-string
and a metadata
attr-map
.
name
is a function with an arity of 0 to 8, inclusive. If the function
accepts an argument, the thingy instance is the first argument, followed by
up to eight additonal arguments.
Example:
(defn-thingy foo-test
"Foo doc-string"
{:added 1.2}
[a b c]
(concat a b c))
(def X (make-thingy :a :b))
(def Y (make-thingy :c :d))
(def Z (make-thingy :e :f))
(X Y Z) ;; => (:a :b :c :d :e :f)
See also make-thingy
.
Defines a _thingy_ function by binding `name` to `body` and assigns it to all instances. Analagous to `defn`, but requires a `doc-string` and a metadata `attr-map`. `name` is a function with an arity of 0 to 8, inclusive. If the function accepts an argument, the thingy instance is the first argument, followed by up to eight additonal arguments. Example: ```clojure (defn-thingy foo-test "Foo doc-string" {:added 1.2} [a b c] (concat a b c)) (def X (make-thingy :a :b)) (def Y (make-thingy :c :d)) (def Z (make-thingy :e :f)) (X Y Z) ;; => (:a :b :c :d :e :f) ``` See also [[make-thingy]].
(make-thingy & xs)
Given elements xs
, returns an instance of a thingy.
See also defn-thingy
.
Given elements `xs`, returns an instance of a _thingy_. See also [[defn-thingy]].
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close