[Top][All Lists]

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

Re: Defining functions within functions?

From: Emanuel Berg
Subject: Re: Defining functions within functions?
Date: Wed, 25 May 2016 00:21:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Carlos Konstanski
<address@hidden> writes:

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

Recursion is cool for schoolbook problems like
list and trees that are searched and shaped
back and forth. In most applications it is
better to use set functions (built-in
higher-order functions) to "do" the list

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

There is nothing wrong with passing things to
functions! On the contrary. It is much clearer
than having scope intermingling like
you describe.

underground experts united ....
Emacs Gnus Blogomatic .........
                   - so far: 40 Blogomatic articles -                   

reply via email to

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