Subject: Re: lambda list question
From: (Rob Warnock)
Date: Wed, 26 Mar 2008 05:55:52 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Pascal Costanza  <> wrote:
| Edi Weitz wrote:
| >"" <> wrote:
| >> This is exactly what I ended up doing, but I make a copy of keys
| >> before removing.
| > 
| > For removing the keys, this might be useful:
| >
| That's too complicated.
| (loop for (key value) on plist by #'cddr
|        when (member key keys-to-keep)
|        collect key collect value)

Uh... But this assumes one knows KEYS-TO-KEEP! The original
problem statement gave a KEYS-TO-STRIP-OUT [not per se,
but implicitly, by naming them], not KEYS-TO-KEEP, with an
&ALLOW-OTHER-KEYS so *anything* could end up in the &REST list.
So I'd think you'd want to write it like this instead:

  (loop for (key value) on plist by #'cddr
         unless (member key keys-to-strip-out)
         collect key collect value)


p.s. If KEYS-TO-STRIP-OUT were *huge*, one might want to use
a hash table for speed:

  (loop for (key value) on plist by #'cddr
         unless (gethash key keys-to-strip-out-table)
         collect key collect value)

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607