Iterate a function while another function is true.
Results are collected in reverse order for performance. Use List.rev if you need results in the order they were produced.
List.rev