Questions tagged [recursion]
5 questions
3
votes
2 answers
Simple recursive function freezes Emacs — how to correct the definition?
I was trying to familiarize myself with several languages by doing the advent of code exercises in these languages, and one that got me stuck is Emacs Lisp, in the very first exercise.
The goal is to count, given a certain list of numbers, the…

jthulhu
- 205
- 1
- 8
2
votes
1 answer
“named-let” bug?
The following code seems fine semantically:
;; -*- lexical-binding: nil; -*-
(named-let f ((_ '(1)))
(dolist (paren-1-paren _)
(f ())))
Why does it throw an error?
(Is this a bug?
If so, I will report it.)
Reported as bug#64290.

shynur
- 4,065
- 1
- 3
- 23
2
votes
1 answer
largest safe value of max-lisp-eval-depth
C-h v max-lisp-eval-depth:
You can safely make it considerably larger than its default value, if that proves inconveniently small.
Yes, I want it to be as large as possible.
However, the docstring also says:
However, if you increase it too far,…

shynur
- 4,065
- 1
- 3
- 23
0
votes
0 answers
Mutually recursive bytecode function throws an error when I try to eval
The following workflow contains the steps needed to reproduce the error:
;; Byte-compile the function.
(byte-compile '(defun flatten (x)
(cl-labels ((rec (x acc)
(cond ((null x) acc)
…

John DeBord
- 550
- 3
- 13
0
votes
1 answer
Having a hard time understanding some of Paul Graham's example code in his book “On Lisp”
https://sep.yimg.com/ty/cdn/paulgraham/onlisp.pdf On page 36 Paul introduces the following function:
(defun flatten (x)
(labels ((rec (x acc)
(cond ((null x) acc)
((atom x) (cons x acc))
…

John DeBord
- 550
- 3
- 13