State >>
 Distance : Float
;

/* * */

Nearest ->
Arg Items : Array | List, Rq : Arg, Pc : Float 
    Value : < &Arg, Arg >, Store : < Arg, Integer >

- Enumerate 'State' Items Rq Pc Value Store Compare
' State : _ = . ..

/

/* * */

Compare Nearest ->
Arg R : ^&Report, A : Data

Previous_distance = 0 ..

Distance = Distance A.Value A.Request

T : Locals = R.Ext.State,
Previous_distance = T.Distance [ R.Ext.State is Locals ]

If A.Step = 1 | Distance < Previous_distance .A.Precision then
 R.Key = A.Key; R.Record = A.Record; R.Step = A.Step
 R.Continue = 0 [ Distance = 0 .A.Precision ]
 Locals : _ = < Distance : _ >
 R.Ext.State = Locals
;

/