Newsgroups: comp.lang.dylan
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!howland.reston.ans.net!vixen.cso.uiuc.edu!sdd.hp.com!night.primate.wisc.edu!aplcenmp!hall
From: hall@aplcenmp.apl.jhu.edu (Marty Hall)
Subject: Searching lists for entries
Message-ID: <DAzznv.96G@aplcenmp.apl.jhu.edu>
Organization: JHU/APL AI Lab, Hopkins P/T CS Faculty
Date: Fri, 30 Jun 1995 18:07:07 GMT
Lines: 24


I was looking for functions that let you retrieve an entry in a list that
looked like some specified value or that passed some
predicate. Something like FIND, FIND-IF, MEMBER or MEMBER-IF in Common
Lisp. All I could find in the DIRM was MEMBER? and FIND-KEY. But
MEMBER? just returns a boolean, not the matching value, and FIND-KEY
results in two passes down the list if you want the actual item.

Obviously I could write my own from scratch or by using REMOVE or
CHOOSE (except that CHOOSE doesn't let you stop after the first
match), but I am curious as to whether I overlooked something. 
Alternatively, maybe somebody could explain the motivation for not
including something of this sort? I guess everyone has their pet
functions, and I concur with the motivation to keep the core language
size down, but in my personal experience in Lisp I use the FIND/MEMBER
family of functions much more than many of types of collection
functions in Dylan. My experience with Dylan is very skimpy, but it
doesn't strike me as being less efficient for MEMBER? (MEMBER) to
return the item instead of #t or FIND-KEY (FIND) to return the item
instead of the index. 

Thanks-
						- Marty
(proclaim '(inline skates))
