Clojure

Add filter-indexed function

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

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.

Activity

Hide
Stuart Halloway added a comment -

Rich: Please mark this waiting on Phil if you want a patch for this, or decline if not.

Show
Stuart Halloway added a comment - Rich: Please mark this waiting on Phil if you want a patch for this, or decline if not.
Hide
Rich Hickey added a comment -

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?

Show
Rich Hickey added a comment - 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?
Hide
Phil Hagelberg added a comment -

OK, this is due to a misunderstanding then; I must have read some misleading info about keep.

Show
Phil Hagelberg added a comment - OK, this is due to a misunderstanding then; I must have read some misleading info about keep.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: