Skip to main content

Questions tagged [recursion]

Filter by
Sorted by
Tagged with
2 votes
2 answers
289 views

Is there a more idiomatic way of repeating a string in Emacs Lisp?

Is there a more idiomatic way to repeat a string in Emacs Lisp? I would define idiomacy as being both efficient in cpu/memory usage (given the task at hand), but also being efficient in terms of ...
anthronima's user avatar
-1 votes
2 answers
178 views

Web scraping traversal using dom.el, pcase error: Unknown pattern

I would like to traverse the dom tree, extract the text and build a list after visiting each node. Implementing the recursion with the help of text-tag function returned an unknown pattern error. The ...
alexander's user avatar
  • 133
0 votes
1 answer
83 views

Text extraction after dom traversal returns empty

I would like to extract the text from each visited node but while traversing and build a list. I only get an empty result. Here is the following attempt using dom.el (defun extract-text-from-dom (dom-...
alexander's user avatar
  • 133
3 votes
1 answer
353 views

“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 ...
shynur's user avatar
  • 6,180
2 votes
1 answer
311 views

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 ...
shynur's user avatar
  • 6,180
3 votes
2 answers
250 views

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 ...
jthulhu's user avatar
  • 225
0 votes
0 answers
54 views

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) ...
John DeBord's user avatar
0 votes
1 answer
178 views

Having a hard time understanding some of Paul Graham's example code in his book “On Lisp” [closed]

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) ...
John DeBord's user avatar