Version of generate that keeps recursively deciding whether to continue generating something, instead of using a fixed-iteration loop.