From: Jeff Dalton
Subject: Re: Questions about CL
Date: 
Message-ID: <8402@skye.ed.ac.uk>
In article <······················@uk03.bull.co.uk> ······@hemel.bull.co.uk (Bill Birch) writes:
>
> I've some questions about Common Lisp rationale:
>
>1.	Why did X3JI3 vote to disallow expressions like:
>
>	(mapcar '(lambda (x y) (sqrt (* x y))) p q)
>
>	"This makes it impermissible to represent a lexical closure
>	as a list whose CAR is some special marker". 
>	
>	(CLtL2 p 37)

To make functions a distinct type.  You can still convert lists to
functions by either using EVAL, COMPILE, or COERCE.

>2.	Why is it "an error to use the FUNCTION special form on a symbol
>	that denotes a macro or special form"? (CLtL2 p 116)

Presumably because they're not, strictly speaking, function names.
However, you can still call symbol-function on these symbols (at
least I htink you can).

>	Does this mean that you cannot pass macros to functions in CL?

No, but there's very little you can usefully and meaningfully do
by passing macros.  The FAQ list discusses this.

>3.	What are the CL equivalents of the old SUBR and FSUBR data types?

SUBRS are more or less just ordinary compiled functions.

FSUBRS are special forms, but users can't define new ones.  You have
to define a function+macro combination instead.  Eg:

(defmacro define-fexpr (name (var) &body forms)
  (let ((fn-name
	 (intern (concatenate 'string (string name) "-FUNCTION")
		 (symbol-package name))))
    `(progn
       (defun ,fn-name (,var)
	 ,@forms)
       (defmacro ,name (&rest ,var)
	 `(,',fn-name ',,var)))))

-- jd