help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Defining functions within functions?


From: Eric Abrahamsen
Subject: Re: Defining functions within functions?
Date: Mon, 23 May 2016 13:34:45 +0800
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> Hi all,
>
> I have a long function with quite a few (even nested) lambdas inside.
> I decided to refactor it so that it becomes more readable.  Since I use
> lexical scoping, simply changing the lambdas into defuns defined
> elsewhere won't work.
>
> In Scheme, one would probably use define inside another define.  Is it
> a good idea to use a (cl-)defun within a defun in Elisp to obtain
> a closure in this situation?  If not, what is a better way?

Sounds like a job for cl-labels!

Eric




reply via email to

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