scan

scan, process option

The scan option applies a process line by line in a specified order, returning the full sequence of intermediate values.

Example

table T = with
  [| as N, as L |]
  [| 1, "b" |]
  [| 0, "a" |]
  [| 2, "c" |]

def process myConcat(t: text) with
  keep txt = ""
  txt = "\{txt}\{t}"
  return txt

T.Asc = myConcat(T.L) scan T.N
T.Desc = myConcat(T.L) scan -T.N

show table "Scan results" with
  T.N
  T.L
  T.Asc
  T.Desc

This outputs the following table:

N L Asc Desc
1 b ab cb
0 a a cba
2 c abc c

Remarks

scan auto uses the primary dimension ordering, which can change if the script or runtime changes. It is unsupported on tuple-typed vectors.

See also

User Contributed Notes
0 notes + add a note