unfold

This function is dual to reduce; instead of taking some functions and a list and producing a value, it takes a value and some functions and produces a list.

This function will return #() if pred(seed) is true.  Otherwise it builds a pair of the form pair(f(seed), unfold(pred, f, g, g(seed) )) .

Thus, this function will always return a proper list, if it terminates at all.

Exported from

Arguments

predAn instance of <function>.  This function takes a seed value and returns #t to terminate the sequence of recursive calls building the list.
fAn instance of <function>.  This function takes a seed value and produces a list element.
gAn instance of <function>.  This function takes a seed value and returns a new seed value.
seedAn instance of <object>.  The initial seed value.

Values

new-listAn instance of <list>.
Returns the result of combining the elements of collection and initial-value according to function.
Sequence-Utilities, written by Matthias Hölzl, provides common or oft-used operations performed on <sequence>s.
The class of objects that can be applied to arguments.
The class of all Dylan objects.
The class of linked lists.