concept input in category clojure
appears as: input, input, The input, inputs, n input, inputs

This is an excerpt from Manning's book Clojure: The Essential Reference.
fnilgenerates a new function starting from another input function "f". The main use case forfnilis to decorate "f" so that it can default to optional values in case the input isnil.fniloperates positionally: "default1" will be used for anilpassed as first argument, "default2" for anilpassed as the second argument and "default3" for anilas the third argument.fnildoesn’t support more than 3 defaults, so(fnil + 1 2 3 4)causes an exception to be thrown.
(defn forever [] (while true ; #1 (Thread/sleep 5000) ; #2 (println "App running. Waiting for input..."))) (defn status-thread [] (let [t (Thread. forever)] ; #3 (.start t) t)) (def t (status-thread)) ;; App running. Waiting for input... ;; App running. Waiting for input... ;; App running. Waiting for input... (.stop t) ; #4 ;; nil
fn contains an example of mergeon an arbitrary number of input maps. apply can be used withmergeif the input is in the form of a list of maps.
Figure 13.2. Chart showing how creation speed changes related to the percentage of distinct items in the input (100% means no repeating items, 0% means the input contains the same repeating element).
![]()