On May 4, 8:50 am, Simon Katz <nomisk...@gmail.com> wrote:
> > For example Common Lisp does support this.
>
> That's not true, or at least it's only partly true.
>
> Here's a translation of your example into Common Lisp (I added a use
> of a# in the macro to avoid compiler optimization making the problem
> go away):
>
>   (defun f (x) (lambda () x))
>   (defparameter foo (f 0))
>   (defmacro bar () `(let ((a# ,foo)) a#))
>   (defun call-bar () (bar))
>
> I can compile this within a Lisp image (not compiling to file), and
> call call-bar with no problems.
>
> But if I try to compile to file, compilation fails with the error
>   Object #<Closure (F . 1) 20094F62> is of type FUNCTION which is not
> externalizable
>
> Common Lisp's notion of externalizable objects (when compiling) is
> defined athttp://www.lispworks.com/documentation/HyperSpec/Body/03_bda.htm.
>
> Regards,
> Simon

Yes.

And actually, it is sort of better to think about (lambda () x) { (fn
[] x), in clojure} as the name of a function. Even though it is also a
list, it is also the name of 'the function that returns x'.

When trying to insert the literal function generated by (lambda () x),
you generate an error, because you can't insert literal functions into
macros, they aren't symbolic... only their names are.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to