help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to mapcar or across a list?


From: Marcin Borkowski
Subject: How to mapcar or across a list?
Date: Wed, 15 Jul 2015 22:14:20 +0200

Hi there,

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?

BTW, my-list doesn't really exist: it is a result of `mapcar'ing
a function taking some value and yielding a Boolean value, so bonus
points if the method does not process the whole list.

(Note: I just noticed that my-list is in fact sorted so that all true
values (if any) will occur at the beginning anyway, so I can just test
the first one.  This means that my problem is purely academic, though
still interesting, I guess.)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

[Prev in Thread] Current Thread [Next in Thread]