Welcome! Please see the About page for a little more info on how this works.

+17 votes
in Clojure by

Using {{juxt}} to aggregate an arbitrary sequence of functions currently requires to treat the empty sequence case separately.
This extra care could be avoided by adding a zero-arity returning a function always returning the empty vector.

`
(defn apply-each-to-42 [fns]
((apply juxt fns) 42))

(apply-each-to-42 [dec identity inc]) ;; returns [41 42 43] as expected
(apply-each-to-42 []) ;; throws exception, expected []
`

3 Answers

0 votes
by

Comment made by: alexmiller

Can you add an example to ticket?

0 votes
by

Comment made by: leonoel

Sure, description updated.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2322 (reported by leonoel)
...