NestWhileList
applies a function
f
repeatedly on an expressionexpr
, until applyingtest
on the result no longer yieldsTrue
. It returns a list of all intermediate results.
supplies the last
m
results totest
(default value:1
). It returns a list of all intermediate results.
supplies all results gained so far to
test
. It returns a list of all intermediate results.
applies
f
toexpr
untiltest
does not returnTrue
. It returns a list of all intermediate results.test
is a function that takes as its arguments the lastm
results.max
denotes the maximum number of applications off
andn
denotes thatf
should be applied anothern
times aftertest
has terminated the recursion. Ifn
is a negative integer, the last-n
elements will be dropped.
Examples
Divide by 2 until the result is no longer an integer:
Implementation status
- ✅ - full supported