chickadee » srfi-189 » maybe-unfold

maybe-unfold stop? mapper successor seed ...procedure
either-unfold stop? mapper successor seed ...procedure

If stop? returns true on seeds, a Nothing / a Left of seeds is returned. Otherwise, successor is applied to seeds. If stop? returns false on the results of successor, it is an error. But if the second call to stop? returns true, mapper is applied to seeds and the results are wrapped in a Just/Right and returned.