From: Marcin Borkowski <mbork@mbork.pl>
To: Carlos Konstanski <ckonstanski@pippiandcarlos.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
Subject: Re: Defining functions within functions?
Date: Wed, 25 May 2016 08:21:44 +0200 [thread overview]
Message-ID: <87twhm64jr.fsf@mbork.pl> (raw)
In-Reply-To: <1464127858.3032.28.camel@pippiandcarlos.com>
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
next prev parent reply other threads:[~2016-05-25 6:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 5:13 Defining functions within functions? Marcin Borkowski
2016-05-23 5:34 ` Eric Abrahamsen
2016-05-24 21:28 ` Marcin Borkowski
2016-05-23 20:09 ` Michael Heerdegen
2016-05-24 21:31 ` Marcin Borkowski
2016-05-24 21:56 ` Drew Adams
2016-05-24 22:10 ` Carlos Konstanski
2016-05-25 6:21 ` Marcin Borkowski [this message]
[not found] ` <mailman.224.1464127813.1216.help-gnu-emacs@gnu.org>
2016-05-24 22:21 ` Emanuel Berg
2016-05-25 6:20 ` Marcin Borkowski
2016-05-25 8:36 ` Stefan Monnier
2016-05-25 8:43 ` Nicolas Petton
2016-05-25 19:30 ` Marcin Borkowski
2016-05-25 9:07 ` tomas
2016-05-25 15:41 ` Marcin Borkowski
2016-05-25 14:18 ` Drew Adams
2016-05-25 15:39 ` Marcin Borkowski
[not found] ` <mailman.255.1464190813.1216.help-gnu-emacs@gnu.org>
2016-05-26 7:52 ` Emanuel Berg
[not found] ` <mailman.223.1464127012.1216.help-gnu-emacs@gnu.org>
2016-05-24 22:17 ` Emanuel Berg
[not found] ` <mailman.222.1464125502.1216.help-gnu-emacs@gnu.org>
2016-05-24 21:46 ` Emanuel Berg
[not found] ` <mailman.141.1464034180.1216.help-gnu-emacs@gnu.org>
2016-05-24 7:13 ` Emanuel Berg
2016-05-24 14:33 ` Barry Margolin
2016-05-24 15:43 ` Emanuel Berg
2016-05-24 16:15 ` Barry Margolin
2016-05-24 21:36 ` Emanuel Berg
[not found] <mailman.94.1463980455.1216.help-gnu-emacs@gnu.org>
2016-05-23 7:47 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87twhm64jr.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=ckonstanski@pippiandcarlos.com \
--cc=help-gnu-emacs@gnu.org \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).