[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lexical mumblings

From: Miles Bader
Subject: Re: lexical mumblings
Date: 19 Oct 2001 17:41:31 +0900

address@hidden (Gerd Moellmann) writes:
> > Of course, the byte-compiler would know that lambda expressions only
> > used by `well-behaved' functions like mapcar can't escape, and so
> > can use the stack-allocated variable-frame.
> Just a nit
> (defvar g)
> (defun f (x) (mapcar (setq g (lambda (e) x)) '(1 2)))
> (f 2)
> (funcall g 1) => ?

In this case, the lambda isn't passed to mapcar, it's passed to setq.

So the compiler would generate a heap-allocated closure, and the
(funcall g 1) would yield `2'.

Saa, shall we dance?  (from a dance-class advertisement)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]