From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Re: How to mapcar or across a list? Date: Wed, 15 Jul 2015 15:21:39 -0700 Message-ID: References: <87io9lmb4z.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1436998935 25073 80.91.229.3 (15 Jul 2015 22:22:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jul 2015 22:22:15 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 16 00:22:15 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZFV4B-0000VN-32 for geh-help-gnu-emacs@m.gmane.org; Thu, 16 Jul 2015 00:22:15 +0200 Original-Received: from localhost ([::1]:37676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFV4A-0008Mi-F1 for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Jul 2015 18:22:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48325) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFV40-0008MS-Ok for help-gnu-emacs@gnu.org; Wed, 15 Jul 2015 18:22:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFV3w-00054I-Qh for help-gnu-emacs@gnu.org; Wed, 15 Jul 2015 18:22:04 -0400 Original-Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:35258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFV3w-00053o-Lh for help-gnu-emacs@gnu.org; Wed, 15 Jul 2015 18:22:00 -0400 Original-Received: by oihq81 with SMTP id q81so38597618oih.2 for ; Wed, 15 Jul 2015 15:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=8BPevaOIRhDEqJginvQA4EbUKugge0V4lAY2xh6IyjM=; b=iznmLGzFKlPl5O6cUex5fnsUMH7wwn2uY6rT4jlX5o08GCZAPeHQ+e40dMF2Mpj0Af bO6wNg5ewTuZ6h7LukYjidmyeGGg+la2yLhcy0VSOFxKQVANo7pZmP4bkrUVrn6x1dhH CO1i5aDTqi6mlKHSSL8usWaYdiQXPAKXp7nHrb0s7DuSZViADG1/1vRHKTFfgzWdfX+Y xbHKa4QlAcTfVwS7FtCyptvUHeVPPhDGeTvxjBxYXduTV/Qdnl9JDmVrgZ46oRJq+08w oMN0ug/jvNOU/rcW20K6azXEZJsgPGNAWKLGeRQBvMj/65ZnaqDO1RNDhMaLGp4nH/mI t01A== X-Received: by 10.60.141.42 with SMTP id rl10mr5669334oeb.25.1436998918925; Wed, 15 Jul 2015 15:21:58 -0700 (PDT) Original-Received: by 10.76.168.70 with HTTP; Wed, 15 Jul 2015 15:21:39 -0700 (PDT) In-Reply-To: <87io9lmb4z.fsf@mbork.pl> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::22f X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105743 Archived-At: > so here's my problem: I have a list of Boolean values, and I want to > `mapcar' an `or' across it (IOW, I want to test whether at least one of > them is true). Of course, (apply #'or my-list) does not work. Of > course, I can (cl-reduce (lambda (x y) (or x y)) my-list) -- but is > there a better method? You've already gotten good answers from others but, for the sake of one more option, you could also accomplish this with `cl-loop' (which, of course, some love and some hate). It would end up looking something like: (cl-loop for item in list thereis (your-predicate item)) If the predicate would be `(not (null item))', you can drop it entirely (as you would expect): (cl-loop for item in list thereis item) -- john