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: Marcin Borkowski
Subject: Re: Defining functions within functions?
Date: Tue, 24 May 2016 23:28:33 +0200
User-agent: mu4e 0.9.16; emacs 25.1.50.1

On 2016-05-23, at 07:34, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

> 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!

Or cl-flet.  But thanks anyway (and I learned about cl-flet when reading
about cl-labels!).

> Eric

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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