Babel specs for filter, map, and possibly other functions allow the first argument to be any to allow the case of an empty sequence (legal in Clojure):
This returns an empty sequence.
However, it leads to a ClassCastException error, not a spec error, on the first argument not being a function when the sequence is not empty, for example:
We need a special spec case for an empty sequence since otherwise error messages for a very common error are not sufficiently descriptive.
Babel specs for
filter,map, and possibly other functions allow the first argument to beanyto allow the case of an empty sequence (legal in Clojure):This returns an empty sequence.
However, it leads to a ClassCastException error, not a spec error, on the first argument not being a function when the sequence is not empty, for example:
We need a special spec case for an empty sequence since otherwise error messages for a very common error are not sufficiently descriptive.