On Mon, Jan 05, 2009 at 10:36:29PM -0800, Yarek Kowalik wrote: > I've run into several situations where I want to query for objects that > match values two or more slots. I currently do something like this: > > (defclass my-class () > ((a :accessor slot-a) > (b :accessor slot-b > :index b)) > (:documentation "my test class")) > > (find-if (lambda (obj) > (equal (slot-a obj) val-a)) > (elephant:get-instances-by-value 'my-class 'slot-b val-b)) > > > Is this a reasonable way of finding an object of type 'my-class that matches > on values val-a and val-b for slots a and b?
Use MAP-CLASS, this will considerably speed up the query. _______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel