[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to mapcar or across a list?
From: |
John Mastro |
Subject: |
Re: How to mapcar or across a list? |
Date: |
Wed, 15 Jul 2015 15:21:39 -0700 |
> 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
- How to mapcar or across a list?, Marcin Borkowski, 2015/07/15
- Re: How to mapcar or across a list?, Rasmus, 2015/07/15
- Re: How to mapcar or across a list?,
John Mastro <=
- Re: How to mapcar or across a list?, Emanuel Berg, 2015/07/15
- Message not available
- Re: How to mapcar or across a list?, Pascal J. Bourguignon, 2015/07/15
- Re: How to mapcar or across a list?, Emanuel Berg, 2015/07/15
- never use `eval' (was: Re: How to mapcar or across a list?), Emanuel Berg, 2015/07/15
- Re: never use `eval' (was: Re: How to mapcar or across a list?), John Mastro, 2015/07/15
- Re: never use `eval' (was: Re: How to mapcar or across a list?), Emanuel Berg, 2015/07/15
- Re: never use `eval' (was: Re: How to mapcar or across a list?), John Mastro, 2015/07/15
- Message not available
- Re: never use `eval' (was: Re: How to mapcar or across a list?), Barry Margolin, 2015/07/15
- Message not available
- Re: never use `eval' (was: Re: How to mapcar or across a list?), Barry Margolin, 2015/07/15
- Re: never use `eval' (was: Re: How to mapcar or across a list?), Emanuel Berg, 2015/07/15