clojure.core/apply¶
Applies fn f to the argument list formed by prepending intervening arguments to args.
Examples¶
Note by virajpurang¶
The first example on the page, does not work on the REPL. It gives the following error:
(def *strings* ["str1" "str2" "str3"])"
Warning: strings not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic strings or change the name.
Should this be prefixed by - "^:dynamic"?
Note by didibus¶
It looks like apply when used with a lazy sequence forces the realization of the first four elements.
(take 1
(apply concat
(repeatedly #(do
(println "called")
(range 1 10)))))
=> "called"
=> "called"
=> "called"
=> "called"
See: https://stackoverflow.com/questions/51959298/clojure-apply-that-does-not-realize-the-first-four-elements-of-a-lazy-sequence
See also¶
- clojure.core/map (13)
- clojure.core/eval (1)
- clojure.template/apply-template
- clojure.core/reduce (22)
- clojure.core/partial (10)
Content from the matching ClojureDocs page, with authors credited on each contribution.