chickadee » list-utils » chain-unfold

chain-unfold FUNC SEED SENTINELprocedure

Returns list of the initial SEED and subsequent results of FUNC on the previous value. A fixnum SENTINEL is treated as a count. Any other value is a termination sentinel.

FUNC
(* -> *) ; curr seed -> next seed
SEED
* ; initial value
SENTINEL
(or fixnum (not fixnum)) ; termination conditon
(chain-unfold add1 1 3)
;=> (1 2 3)