fixedpoint

From The K Language Wiki
Revision as of 04:39, 28 July 2021 by Razetime (talk | contribs) (add fixpoint page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Fixedpoint
f/y
f\y

fixedpoint and scan-fixedpoint are adverbs which apply a single-argument(monadic) function to a given noun y until it stops changing, or the initial value has been repeated.

Fixedpoint(/) produces a single value, the final value.

Scan-fixedpoint(\) produces a list of all intermediate values. It is often useful for debugging fixedpoint.

 {0|x-1}/56
0

 {0|x-1}\56
56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0