def run_guarded
stelliferous@0.0.2.0 · tensor_access.bend:34
import stelliferous@0.0.2.0/tensor_access.bend as TensorAccess
import Base
import stelliferous@0.0.2.0/traversal_array.bend as Traversal
import stelliferous@0.0.2.0/traversal_loop.bend as Loop
import stelliferous@0.0.2.0/tensor_cursor.bend as Cursor
34
35
36
37def run_guarded(~Element: Data,~inside: Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Stride> -> Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Stride>,~last: Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Cursor> -> Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Cursor>,full_run: Bool,whole_runs: Bool,runs: Nat,count: Nat,cursor: Cursor.Cursor,destination: U32,
38 input: Array<Element>,output: Array<Element>) -> Array<Element> & Array<Element>:
39 match full_run whole_runs:
40 case True{} True{}:
41 Traversal.finish(~Array<Element>,~Element,~Cursor.Cursor,
42 Loop.run(~Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Cursor>,~run_step(~Element,~inside,~last),runs,
43 Traversal.State{input,output,destination,cursor}))
44 case full_run whole_runs:
45 Traversal.finish(~Array<Element>,~Element,~Cursor.Cursor,
46 Loop.run(~Traversal.State<&1,&1,Array<Element>,Array<Element>,Cursor.Cursor>,~last,count,Traversal.State{input,output,destination,cursor}))