Hi Miro,
It's and() which is doing the eval on its arguments. and is a "syntax" form - this is because if you do something like:
and(boundp('fred) fred)
it will work successfully if fred isn't defined - sometimes known in some languages as "expression short circuting" - it's only going to evaluate the second (or third, or fourth etc) argument if the preceding arguments are non-nil.
So when you do:
and(list(1 2))
The list() doesn't get evaluated until the and decides it should be.
If you do:
apply('and list(list(1 2)))
then the list is evaluated before the apply gets called - and so the and call is like:
and((1 2))
which is why you have the problem. You need to prevent the arguments from being evaluated.
So something like:
apply('and '(list(1 2)))
will do it. Chances are you wanted something to be evaluated in the argument though, so it might need to be something like:
a=1
b=2
apply('and `(list(,a ,b)))
Hope that helps!
Put simply, you have to be careful with using apply with syntax forms, nlambda functions, and macros, to make sure that the evaluation occurs at the right time.
Regards,
Andrew.
Originally posted in cdnusers.org by adbeckett