if this works exactly like "indexOf" in java, then it seems like it should be in the core ... but as "position", or "pos", based on your description. Why the core? I'm mentioned this before: symmetry, since nth is there. Others would argue, "leave it out" since there's a way to do it from java. Personally, if you don't know java, you ain't gonna be thinking "indexOf".
On Mon, Aug 17, 2009 at 7:32 PM, Sean Devlin <[email protected]>wrote: > > Hmmm... this seems like a cool way to do this. Could you provide an > example for when you need to this? A few use cases would help me > understand the intent. > > Sean > > On Aug 17, 7:18 pm, Stuart Halloway <[email protected]> wrote: > > I wrote this for the book: > > > > (defn index-filter [pred coll] > > (when pred > > (for [[idx elt] (indexed coll) :when (pred elt)] idx))) > > > > and I keep finding myself needing it all over the place. Is there a > > better idiom for finding *positions* of things in a sequence, rather > > than the things themselves? If not, should I add this to contrib? > > > > Stuart (H) > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
