From: Andrew Philpot
Subject: DEFSUBST
Date: 
Message-ID: <1994Feb25.003610.10832@kronos.arc.nasa.gov>
A few weeks ago I recall someone talking about using compiler macros to implement
DEFSUBST.  Since my Lisp (Allegro) isn't real good about obeying INLINE
declarations (which is well within the standard), but since I need functional
abstraction without function calling overhead, a DEFSUBST would be attractive to
me.  Has anyone worked on this?  I bet I could do it without too much trouble but
I bet that someone has already tinkered with it.

Email, or post.

Thanks.


-- 
Andrew Philpot	 		
Recom Tech/NASA Ames 		
·······@ptolemy.arc.nasa.gov	
			        

From: Barry Margolin
Subject: Re: DEFSUBST
Date: 
Message-ID: <2kocp1INN1ag@early-bird.think.com>
The dpANS defines "compiler macros", which allow you to define a macro
implementation of a function in addition to the regular functional
implementation.  The compiler is expected to expand the compiler-macro, but
the function would still be available for the interpreter and for passing
as functional arguments.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar
From: Cyber Surfer
Subject: Re: DEFSUBST
Date: 
Message-ID: <CLx97L.6Au@cix.compulink.co.uk>
What is DEFSUBST? Is it part of Common Lisp, and why would I
want to use it?

Thanks,
Martin Rodgers

--- Cyber Surfing on CIX ---
From: Barry Margolin
Subject: Re: DEFSUBST
Date: 
Message-ID: <2kudj5INNl1v@early-bird.think.com>
In article <··········@cix.compulink.co.uk> ············@cix.compulink.co.uk ("Cyber Surfer") writes:
>What is DEFSUBST? Is it part of Common Lisp, and why would I
>want to use it?

It was the Lisp Machine Lisp macro for defining an inline function.  A
"subst" is a substitutable function, i.e. a function whose body is
substituted for the call.  Proclaiming a function INLINE is the CL way to
do it.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar
From: Rick Busdiecker
Subject: Re: DEFSUBST
Date: 
Message-ID: <RFB.94Mar1171210@fnord.lehman.com>
In article <··········@cix.compulink.co.uk> ············@cix.compulink.co.uk ("Cyber Surfer") writes:

   What is DEFSUBST? Is it part of Common Lisp, and why would I
   want to use it?

DEFSUBST is essentially:

(defmacro defsubst (name lambda &body body)
  `(progn
     (declaim (inline ,name))
     (defun ,name ,lambda ,@body)))

You might want to use it if you found it to be more clear than
declaiming your function to be inline by some other means.

-- 
Rick Busdiecker <···@lehman.com> and <···@cmu.edu>
  Lehman Brothers           
  388 Greenwich Street      ``A great many people think they are thinking when
  New York, NY 10013          they are merely rearranging their prejudices.''
  (212) 464-4750                                        - William James
From: Cyber Surfer
Subject: Re: DEFSUBST
Date: 
Message-ID: <CM4oAF.7zL@cix.compulink.co.uk>
In article <················@fnord.lehman.com>,
···@lehman.com (Rick Busdiecker) writes:
 
> DEFSUBST is essentially:
> 
> (defmacro defsubst (name lambda &body body)
>   `(progn
>      (declaim (inline ,name))
>      (defun ,name ,lambda ,@body)))
> 
> You might want to use it if you found it to be more clear than
> declaiming your function to be inline by some other means.

I had wondered if it had anything to do with SUBST, but it
doesn't look like it. Thanks, that's cleared that up. Thanks
also to everyone who replied by email.

Martin Rodgers

--- Cyber Surfing on CIX ---
From: Jeff Dalton
Subject: Re: DEFSUBST
Date: 
Message-ID: <CMB9uB.HsB@cogsci.ed.ac.uk>
In article <················@fnord.lehman.com> ···@lehman.com (Rick Busdiecker) writes:
>In article <··········@cix.compulink.co.uk> ············@cix.compulink.co.uk ("Cyber Surfer") writes:
>
>   What is DEFSUBST? Is it part of Common Lisp, and why would I
>   want to use it?
>
>DEFSUBST is essentially:
>
>(defmacro defsubst (name lambda &body body)
>  `(progn
>     (declaim (inline ,name))
>     (defun ,name ,lambda ,@body)))
>
>You might want to use it if you found it to be more clear than
>declaiming your function to be inline by some other means.

It's essentially that only if you suppose that proclaiming something
INLINE causes it to be expanded in-line.  But it doesn't: it's
implementation-dependent.

DEFSUBST can be implemented for Lisps that won't in-line by defining
both a function (for #' use) and a compiler macro.  Of course, for
the others, it could just use an INLINE proclamation, in case that
works better in some way.

You might want to use it if you want in-lining to really happen in
all Lisps.

-- jd