From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: execute defun on reception of signal
Date: Tue, 14 Jul 2015 23:33:43 +0200 [thread overview]
Message-ID: <87r3oafmq0.fsf@nl106-137-147.student.uu.se> (raw)
In-Reply-To: 87bnffo3yz.fsf@kuiper.lan.informatimago.com
"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:
> Emanuel Berg <embe8573@student.uu.se> writes:
>
>> Rusi <rustompmody@gmail.com> writes:
>>
>>> However on a docs-improving note here's this little titbit: [On other thread] There was this claim "letrec is nice" or some such. Since I know letrec from scheme etc but never seen in elisp I was curious. I find: describe-function tells nothing about the recursion the elisp info pages (index) seems to not have it at all
>> There is no mention of "letrec" in
>> /usr/share/info/emacs-24/elisp.info I don't know the
>> policy. Are *all* functions, macros, etc.
>> supposed to be in the Elisp manual?
>
> letrec is not emacs lisp, it's scheme.
OK, but it is here as well:
letrec is a Lisp macro in `subr.el'.
(letrec BINDERS &rest BODY)
Bind variables according to BINDERS then eval BODY.
The value of the last form in BODY is returned.
Each element of BINDERS is a list (SYMBOL VALUEFORM) which binds
SYMBOL to the value of VALUEFORM.
All symbols are bound before the VALUEFORMs are evalled.
> In Common Lisp, one would use labels, so in emacs
> lisp you can write:
>
> (require 'cl) (defun fact (n) (labels ((f (n f)
> (if (plusp n) (f (- n 1) (* n f)) f))) (f n 1)))
>
> provides a nice tail-recursive
> factorial implementation.
I know about labels - I don't use them myself as I'm
happy to have everything on the same level.
Functions do things - they are like tools, and you
never now when you need them or in what context.
Variables, the other way around, they should be
encapsulated in all but exceptional cases. But anyway,
why do you bring this up? With letrec, can you do both
variables and setup local functions or something
like that?
--
underground experts united
http://user.it.uu.se/~embe8573
next prev parent reply other threads:[~2015-07-14 21:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-12 1:59 execute defun on reception of signal Emanuel Berg
2015-07-12 10:27 ` Andy Moreton
2015-07-12 16:56 ` Emanuel Berg
2015-07-12 18:54 ` Andy Moreton
2015-07-13 3:53 ` Vaidheeswaran C
2015-07-14 1:49 ` Emanuel Berg
[not found] ` <mailman.6808.1436727285.904.help-gnu-emacs@gnu.org>
2015-07-13 2:29 ` Rusi
2015-07-13 2:57 ` Emanuel Berg
2015-07-13 3:39 ` Vaidheeswaran C
2015-07-14 1:43 ` Emanuel Berg
2015-07-14 1:58 ` Vaidheeswaran C
2015-07-14 1:59 ` Emanuel Berg
2015-07-14 2:07 ` Emanuel Berg
2015-07-14 2:09 ` Vaidheeswaran C
2015-07-14 22:14 ` Emanuel Berg
2015-07-13 8:28 ` Andy Moreton
2015-07-13 14:49 ` Nicolas Richard
2015-07-13 15:22 ` Eli Zaretskii
2015-07-13 14:44 ` Eli Zaretskii
[not found] ` <mailman.6850.1436798656.904.help-gnu-emacs@gnu.org>
2015-07-13 14:57 ` Rusi
2015-07-13 15:18 ` Thierry Volpiatto
2015-07-13 15:28 ` Eli Zaretskii
[not found] ` <mailman.6858.1436801328.904.help-gnu-emacs@gnu.org>
2015-07-13 16:13 ` Rusi
2015-07-14 1:53 ` Emanuel Berg
[not found] ` <mailman.6892.1436840915.904.help-gnu-emacs@gnu.org>
2015-07-14 2:41 ` Pascal J. Bourguignon
2015-07-14 21:33 ` Emanuel Berg [this message]
[not found] ` <mailman.6932.1436909731.904.help-gnu-emacs@gnu.org>
2015-07-14 22:11 ` Pascal J. Bourguignon
2015-07-14 22:21 ` Emanuel Berg
[not found] ` <mailman.6936.1436912565.904.help-gnu-emacs@gnu.org>
2015-07-15 15:25 ` Rusi
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3oafmq0.fsf@nl106-137-147.student.uu.se \
--to=embe8573@student.uu.se \
--cc=help-gnu-emacs@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.