[CLJ-670] Add filter-indexed function Created: 04/Nov/10 Updated: 06/Jan/11 Resolved: 06/Jan/11 |
|
| Status: | Closed |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Phil Hagelberg | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Waiting On: | Phil Hagelberg |
| Description |
|
In Clojure 1.2, keep-indexed and map-indexed were introduced in lieu of promoting clojure.contrib.seq/indexed. The difference between filter and keep is that keep treats false and nil differently; only nil values are removed. This behaviour may be desired in some places, but filter is much more common. It seems that since keep-indexed exists without filter-indexed, people might pull in the nil/false distinction where that's not appropriate. I can provide a patch for this if desired. |
| Comments |
| Comment by Stuart Halloway [ 31/Dec/10 3:43 PM ] |
|
Rich: Please mark this waiting on Phil if you want a patch for this, or decline if not. |
| Comment by Rich Hickey [ 04/Jan/11 8:17 PM ] |
|
The difference between filter and keep is that filter returns the values in the collection based upon the predicate function and keep returns the result of the function itself. Is this an actual problem people are having or a completeness exercise? |
| Comment by Phil Hagelberg [ 06/Jan/11 4:02 PM ] |
|
OK, this is due to a misunderstanding then; I must have read some misleading info about keep. |