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



fishmacs <wzhao1984@xxxxxxxxx> writes:

pjb@xxxxxxxxxxxxxxxxx (Pascal J. Bourguignon) writes:

Indeed, AND and OR are macros, not functions. This allows to shortcut:
But SBCL said AND is a closure?

Of course, macros are functions! They're code making code.

But if you know how to ask, you'll see clearly AND is fbound to a
macro:

S/CL-USER[42]> (describe 'and)

AND is an external symbol in #<PACKAGE "COMMON-LISP">.
Macro-function: #<FUNCTION (MACRO-FUNCTION AND) {957F0C5}>Its associated name (as in FUNCTION-LAMBDA-EXPRESSION) is (MACRO-FUNCTION AND).
The macro's arguments are: (&REST FORMS)
On Sun, Mar 9, 2008 11:40:31 PM [-1] it was compiled from:
SYS:SRC;CODE;DEFBOOT.LISP Created: Saturday, March 3, 2007 11:49:26 AM [-1]
Documentation on the method-combination:NIL


S/CL-USER[43]> (symbol-function 'and)

#<CLOSURE (SB-C::&OPTIONAL-DISPATCH (LAMBDA (&REST SB-C::ARGS))) {99B040D}>

S/CL-USER[44]> (macro-function 'and)

#<FUNCTION (MACRO-FUNCTION AND) {957F0C5}>

S/CL-USER[45]>


--
__Pascal Bourguignon__ http://www.informatimago.com/

COMPONENT EQUIVALENCY NOTICE: The subatomic particles (electrons,
protons, etc.) comprising this product are exactly the same in every
measurable respect as those used in the products of other
manufacturers, and no claim to the contrary may legitimately be
expressed or implied.
.



Relevant Pages

  • Re: OpenMCL and LispWorks work, CLISP and CMUCL fail on macros
    ... > implementation available to me that works with my macros is LispWorks; ... would you want to save an _interpreted_ closure into a _compiled_ file? ... to a compiled file) is being coerced to a closure prematurely. ... while explicitly compiling the closure will solve your ...
    (comp.lang.lisp)
  • Re: reject duplicates in a hashtable?
    ... >> You'll have to copy and alter the actual code that's called by (setf ... > code via macros and backquoting. ... Not in SBCL, he wouldn't, and probably not anywhere else either. ...
    (comp.lang.lisp)
  • Re: Macros calling macros
    ... d> Any ideas appreciated (would generating a closure with it's own level ... i guess your problem is that you're using variable *indent* in your macros. ... as computing indent amount) ...
    (comp.lang.lisp)
  • @ list splicing bug?
    ... CMUCL and SBCL return `((cons 'a a)). ... I've distilled this example from one of the macros I have written that has ...
    (comp.lang.lisp)
  • Re: Parens Matching
    ... Wow thanks for all the quick replies. ... and I plan on 'abstractaway'. ... macros, which I have not really learned yet (I read the macros chapter ... I am using SLIME with SBCL. ...
    (comp.lang.lisp)