comp.emacs
[Top] [All Lists]

Re: Is lexical closure of elisp weeker than in clisp?

Subject: Re: Is lexical closure of elisp weeker than in clisp?
From: David Kastrup
Date: Fri, 08 Aug 2008 22:40:28 +0200
Newsgroups: comp.emacs

Daneel Yaitskov <rtfm.rtfm.rtfm@xxxxxxxxx> writes:

> The snippet of the lisp code:
>
> (defun create-counter (start)
>   #'(lambda () (setq start (+ start 1))))

(eval-when-compile (require 'cl))

(defun create-counter (start)
  (lexical-let ((start start))
    (lambda () (setq start (1+ start)))))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy