[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: execute defun on reception of signal
From: |
Pascal J. Bourguignon |
Subject: |
Re: execute defun on reception of signal |
Date: |
Tue, 14 Jul 2015 04:41:40 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
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.
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.
(fact 10) --> 3628800
(fact 41) --> 1716706262231547904
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
- Re: execute defun on reception of signal, (continued)
- Re: execute defun on reception of signal, Eli Zaretskii, 2015/07/13
- Message not available
- Re: execute defun on reception of signal, Rusi, 2015/07/13
- Re: execute defun on reception of signal, Thierry Volpiatto, 2015/07/13
- Re: execute defun on reception of signal, Eli Zaretskii, 2015/07/13
- Message not available
- Re: execute defun on reception of signal, Rusi, 2015/07/13
- Re: execute defun on reception of signal, Emanuel Berg, 2015/07/13
- Message not available
- Re: execute defun on reception of signal,
Pascal J. Bourguignon <=
- Re: execute defun on reception of signal, Emanuel Berg, 2015/07/14
- Message not available
- Re: execute defun on reception of signal, Pascal J. Bourguignon, 2015/07/14
- Re: execute defun on reception of signal, Emanuel Berg, 2015/07/14
- Message not available
- Re: execute defun on reception of signal, Rusi, 2015/07/15