ground cases for maps of zero colls #20

Closed
wants to merge 1 commit into
from

2 participants

@mental

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).

@mental

After some soul-searching about the CA process, I'm releasing this patch into the public domain.

@coltnz

i like this but it needs to be done via dev mailing list and jira post CA

@Tirael90 Tirael90 referenced this pull request in clojure-android/clojure Nov 19, 2014
Closed

Android 5.0 - L #3

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment