Fixedpoint: Difference between revisions

From The K Language Wiki
Content added Content deleted
(add fixpoint page)
 
mNo edit summary
Line 1: Line 1:
{{primitive|f/y<br>f\y}}
{{primitive|f/y<br>f\y}}


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


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

Revision as of 08:41, 31 July 2021

Fixedpoint
f/y
f\y

fixedpoint and scan-fixedpoint are adverbs that apply a 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