2 votes

Iterate over vector (or sequence) and use index and value in conditional

seq-do-indexed is the function to use here. Here is an example of its usage: (let ((selectr [0 1 1 0 0])) (seq-do-indexed (lambda (e i) (print (append (list e i) ...
  • 4,015
1 vote

Simple recursive function freezes Emacs — how to correct the definition?

Elisp does not implement Tail-Call Optimization (TCO). Your first recursive solution fails with (error "Lisp nesting exceeds ‘max-lisp-eval-depth’") at least here. tco.el is a package, ...
  • 4,306

Only top scored, non community-wiki answers of a minimum length are eligible