[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: |
Wed, 25 May 2016 08:21:44 +0200 |
User-agent: |
mu4e 0.9.16; emacs 25.1.50.1 |
On 2016-05-25, at 00:10, Carlos Konstanski <ckonstanski@pippiandcarlos.com>
wrote:
> Am Dienstag, den 24.05.2016, 14:56 -0700 schrieb Drew Adams:
>> >
>> > And I wanted to use the former variant, but it struck me as not
>> > very
>> > elegant.As for the latter, I'm not sure I understand it exactly,
>> > but
>> > I'll give it some thought.
>> >
>> > For now, I decided to go with lambdas, but also to sprinkle the
>> > code
>> > with comments.Old-fashioned, but should do the jon in my case.
>> A suggestion: Post a concrete example of what you need, and
>> see what concrete suggestions you get.
>>
>> Typically, this stuff is not complicated.The first thing
>> to do, IMO, is to determine whether you really need/want to
>> do something special/complicated.Why do you think you want
>> a nested defun or other form of local function definition?
>
> My 2 cents: as a common lisp propgrammer, I find two uses for
> labels/flet:
>
> - Recusrion. The wrapping code sets up the initial enviornment and then
> calls the inner function where all the real work happens. In all other
> languages you need two functions, but in lisp you can package the
> entire thing into one form with an inner function.
That I don't need.
> - Arguments for free: If the flet is defined within the lexical scope
> of some bindings, you can treat those bindings as "globals" and not
> have to pass them into the function. I'm guessing this is what all the
> let-over-lambda talk is about.
And those I do use.
> Both of these are valid uses of labels. Unless you have code
> portability concerns, don't shy away from a package that gives emacs
> lisp the same power as the other lisps.
If you mean (require 'cl-lib), I do it anyway. And if /I/ didn't,
request.el does.
> Carlos
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
- Defining functions within functions?, Marcin Borkowski, 2016/05/23
- Re: Defining functions within functions?, Eric Abrahamsen, 2016/05/23
- Re: Defining functions within functions?, Michael Heerdegen, 2016/05/23
- Re: Defining functions within functions?, Marcin Borkowski, 2016/05/24
- Re: Defining functions within functions?, Marcin Borkowski, 2016/05/25
- Re: Defining functions within functions?, Stefan Monnier, 2016/05/25
- Re: Defining functions within functions?, Nicolas Petton, 2016/05/25
- Re: Defining functions within functions?, Marcin Borkowski, 2016/05/25
- Re: Defining functions within functions?, tomas, 2016/05/25
- Re: Defining functions within functions?, Marcin Borkowski, 2016/05/25
- RE: Defining functions within functions?, Drew Adams, 2016/05/25
- Re: Defining functions within functions?, Marcin Borkowski, 2016/05/25