Re: (apply #'and '(t t nil)) not work



??>> this looks just like AND, but it does not short-circuit evaluation.
f> Thanks all responses. But I do need short-circuit evalution.

short-circuiting only makes sense when you do evaluation.
if you have a list,it's contents are already evaluated, hence
short-circuiting doesn't make sense.

if you post some bigger sample of what you want to achieve perhaps we can
point what is best way of implementing this.

f> I wrote a macro(very silly):
f> (defmacro andl (lst)
f> `(and ,@lst))
f> if type (andl '(1)) in the REPL, I get the error:
f> EVAL: variable QUOTE has no value

sure it does not. because it is a macro, and it's contents are not
evaluated.

i advice not to use macros or EVAL unless you _absolutely_ want to. keep in
mind you can do 99.99% of stuff w/o macros and eval -- macros just make some
code more elegant, eval can help with extreme dynamism.
you absolutely do not need to write macros or use something advanced when
you're just writing regular code.


.



Relevant Pages

  • Re: how to define a local function
    ... typically just used to illustrate what macros can do. ... evaluation in standard funcall (so much for first class ... going through all functions and turning them into delaying ones ... that is losing first class functions. ...
    (comp.lang.lisp)
  • Re: Paper on PL/I
    ... Short-circuit evaluation is not only not the default, ... >> Ada is a dead language from a market acceptance point of view. ... > PL/I, being largely confined to defense and similar markets. ...
    (comp.lang.pl1)
  • Re: Saving expressions as lists?
    ... > I wanted to teach myself more about Scheme, so I thought I'd just try ... > to implement APPLY without using macros. ... be a quote expression. ... evaluation of them as well, which wouldn't be what you want. ...
    (comp.lang.scheme)
  • Re: EXPRESSION EVALUATION
    ... No, the Boolean version is ... > logic to short-circuit the evaluation in the first case, ...
    (comp.lang.pl1)
  • Re: Evaluation order not specified in LRM?
    ... and that the operands of '&' might be evaluated left-to-right. ... Are there any requirements on the evaluation ... Or any specific short-circuit requirements? ... DOULOS - Developing Design Know-how ...
    (comp.lang.verilog)