Function: -unfold
-unfold is a byte-compiled function defined in dash.el.
Signature
(-unfold FUN SEED)
Documentation
Build a list from SEED using FUN.
This is "dual" operation to -reduce-r: while -reduce-r
consumes a list to produce a single value, -unfold takes a
seed value and builds a (potentially infinite!) list.
FUN should return nil to stop the generating process, or a cons (A . B), where A will be prepended to the result and B is the new seed.
Source Code
;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -unfold (fun seed)
"Build a list from SEED using FUN.
This is \"dual\" operation to `-reduce-r': while -reduce-r
consumes a list to produce a single value, `-unfold' takes a
seed value and builds a (potentially infinite!) list.
FUN should return nil to stop the generating process, or a
cons (A . B), where A will be prepended to the result and B is
the new seed."
(declare (important-return-value t))
(let ((last (funcall fun seed)) r)
(while last
(push (car last) r)
(setq last (funcall fun (cdr last))))
(nreverse r)))