clojure/clojure — pull request #20 by mental (2012-03-24 00:30:31+00:00)
Title: ground cases for maps of zero colls

The pattern (apply map f colls) appears in a lot of Clojure code (including clojure.core, in the implementation of mapcat), but it currently requires extra logic to not be buggy if colls is an empty sequence, since there is no single-argument variant of map. It's easy enough to extend map to usefully cover a single argument, though; (map f) can simply return (), analogous to the way that (+) returns 0.

This branch adds such a ground case to map, mapv, and pmap, and adds a test for mapcat, which already accepted a single argument (but which had been broken for the reasons given above).