No matching definitions.

tur/zipper

stdlib/zipper.tur

typed Zipper[A]: 1D list zipper with typed focus and neighbors.

Since: Phase TC2-B

defopaque

Zipper

(Zipper [A] :int))

parameterized 1D list zipper with element type A.

Since: Phase TC2

defn

zipper-new-raw

(zipper-new-raw [left ptr<void> left-len : int focus : int right ptr<void> right-len : int])

create a Zipper[A] from left array, focus, and right array.

leftpointer to left neighbor array (int64_t*); leftmost = furthest from focus
left-lennumber of elements in left
focusfocused element of type A
rightpointer to right neighbor array (int64_t*); rightmost = furthest from focus
right-lennumber of elements in right

A new Zipper[A].

(let [l (make-left-arr)
        r (make-right-arr)
        z (zipper-new l 2 5 r 2)]
    (free l) (free r)             ; caller retains l / r ownership
    ... use z ...
    (zipper-free z))             ; frees the copies inside z

Since: Phase TC2

defn

zipper-new

(zipper-new [A])

by-value: recover A from the typed focus element.

defn

zipper-focus-raw

(zipper-focus-raw [z : int])

return the focused element of a Zipper[A].

zZipper[A]

The focused element of type A.

(zipper-focus z)  ; => focused element

Since: Phase TC2

defn

zipper-focus

(zipper-focus [A])

by-value: return the focused element typed as A.

defn

zipper-move-left-raw

(zipper-move-left-raw [z : int])

move the focus one step to the left; returns Option[Zipper[A]].

zZipper[A]

some(new-zipper) if left neighbor exists, none otherwise.

(zipper-move-left z)  ; => some(z') or none

Since: Phase TC2

defn

zipper-move-left

(zipper-move-left [A])

by-value: some(z') if a left neighbor exists, else none.

defn

zipper-move-right-raw

(zipper-move-right-raw [z : int])

move the focus one step to the right; returns Option[Zipper[A]].

zZipper[A]

some(new-zipper) if right neighbor exists, none otherwise.

(zipper-move-right z)  ; => some(z') or none

Since: Phase TC2

defn

zipper-move-right

(zipper-move-right [A])

by-value: some(z') if a right neighbor exists, else none.

defn

zipper-free-raw

(zipper-free-raw [z : int])

free a Zipper[A] and its neighbor arrays.

zZipper[A] to free
(zipper-free z)

Since: Phase TC2

defn

zipper-free

(zipper-free [A])

by-value: free a Zipper[A] and its neighbor arrays.