Re: (apply #'and '(t t nil)) not work
- From: pjb@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon)
- Date: Mon, 31 Mar 2008 17:34:17 +0200
fishmacs <wzhao1984@xxxxxxxxx> writes:
"Alex Mizrahi" <udodenko@xxxxxxxxxxxxxxxxxxxxx> writes:
of course you can define your own function -- to get rid of #'indetityThanks all responses. But I do need short-circuit evalution.
parameter, or allowing it to agruments directly. i.e.
(defun my-and (&rest args) (every #'identity args))
CL-USER> (my-and t t nil)
NIL
CL-USER> (apply #'my-and '(t t nil))
NIL
this looks just like AND, but it does not short-circuit evaluation.
I wrote a macro(very silly):
(defmacro andl (lst)
`(and ,@lst))
if type (andl '(1)) in the REPL, I get the error:
EVAL: variable QUOTE has no value
And who said EVERY and SOME don't do short circuit?
(every (function print) '(t t t nil 1 2 3 4))
prints:
T
T
T
NIL
returns:
NIL
(some (function print) '(nil nil nil t 1 2 3 4))
prints:
NIL
NIL
NIL
T
returns:
T
--
__Pascal Bourguignon__
.
- References:
- (apply #'and '(t t nil)) not work
- From: fishmacs
- Re: (apply #'and '(t t nil)) not work
- From: Alex Mizrahi
- Re: (apply #'and '(t t nil)) not work
- From: fishmacs
- (apply #'and '(t t nil)) not work
- Prev by Date: Re: (apply #'and '(t t nil)) not work
- Next by Date: Two questions about prog2
- Previous by thread: Re: (apply #'and '(t t nil)) not work
- Next by thread: Re: (apply #'and '(t t nil)) not work
- Index(es):
Relevant Pages
|