Path: utzoo!mnetor!uunet!husc6!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.lisp Subject: Re: Filtering Vectors in CL Question Message-ID: <13979@think.UUCP> Date: 18 Dec 87 21:06:59 GMT References: <1350001@otter.HP.COM> Sender: usenet@think.UUCP Reply-To: barmar@sauron.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 18 In article <1350001@otter.HP.COM> kers@otter.HP.COM (Christopher Dollin) writes: >What is the idiomatic and efficent way in CL to filter a vector; that is, to >make a new vector from an existing vector, containing only those elements >that satisfy some patameter predicate, and preserving the order? (defun filterv (v p) (delete-if-not p v)) The second argument of DELETE-IF-NOT is actually a sequence, which encompasses lists and vectors, and the result is a sequence of the same type as the input. --- Barry Margolin Thinking Machines Corp. barmar@think.com seismo!think!barmar