Gnus development mailing list
 help / color / mirror / Atom feed
From: sigurd@12move.de (Karl Pflästerer)
Subject: Re: gnus-summary-limit-to-recipient and
Date: Sat, 04 Dec 2004 22:30:27 +0100	[thread overview]
Message-ID: <uacstg39o.fsf@hamster.pflaesterer.de> (raw)
In-Reply-To: <v9d5xr9xoz.fsf@marauder.physik.uni-ulm.de>

On  3 Dez 2004, reinersteib+gmane@imap.cc wrote:

> An elisp question related to this: Give two lists of number, `to' and
> `cc'.  What is the best way to get a list of all numbers that are
> present in both lists?
>
> Example:
>
> to -> (173     175     177 178     180 181 182 183 184)
> cc -> (173 174 175 176 177 178 179 180 181 182 183 184)
>
> goal: (173     175     177 178     180 181 182 183 184)
>
> I have done it as follows (the "not-matching"-part), but maybe I was
> missing a more simple solution:
>
>   (let* ((to ...) ; list of numbers
> 	 (cc ...) ; list of numbers
> 	 (articles
> 	  (if not-matching
> 	      ;; We need the numbers that are in both lists:
> 	      (mapcar (lambda (a)
> 			(and (memq a to) a))
> 		      cc)
> 	    (nconc to cc))))
>     ...)

You could simply write:
    (intersection list1 list2) or
    (nintersection list1 list2)

If the order matters you perhaps have to write:
   (nreverse (nintersection list1 list2))

This is code from the CL lib so a `(require 'cl)' is needed.


   KP



      reply	other threads:[~2004-12-04 21:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 22:44 gnus-summary-limit-to-recipient and gnus-summary-sort-by-recipient Reiner Steib
2004-12-03  0:05 ` Tassilo Horn
2005-09-07 16:17   ` Reiner Steib
2004-12-03  7:36 ` Romain Francoise
2004-12-03  8:49   ` gnus-summary-limit-to-recipient and Reiner Steib
2004-12-03 11:10     ` Romain Francoise
2004-12-03 16:02 ` Reiner Steib
2004-12-04 21:30   ` Karl Pflästerer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uacstg39o.fsf@hamster.pflaesterer.de \
    --to=sigurd@12move.de \
    --cc=khp@pflaesterer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).