def view

lawful-arrays@0.1.0.0 · defs.bend:22

import lawful-arrays@0.1.0.0/defs.bend as Defs
import Base

22# The leaves of a, left to right (the same list as Base's Array.to_list, which
23# is a template and cannot appear in a law). Elements must be Data.
24def view(-T: Data, a: Array<T>) -> List<&2, T>:
25  match a:
26    case ALeaf{x}:
27      [x]
28    case ANode{xs, ys}:
29      List.append(&2, T, view(T, xs), view(T, ys))

Uses (3)

Used by (29)