tur/pair
typed Pair[A B]: parameterized two-element tuple.
Generic two-element tuple with typed first and second elements. Runtime layout specializes fst/snd for concrete A/B.
Since: Phase TC1-F
TurMutCell
(defstruct TurMutCell :heap [A] (v A))
internal: the shared heap cell of a ^mut a lambda captures.
A compiled closure copies each variable it captures into its env, so a set! in one closure (or in the enclosing scope) was invisible to every other copy. The elaborator gives such a variable one of these cells and rewrites its reads and writes to the field, so every env shares the cell (compiled-closure-copies-a-captured-mut). Not for direct use.
Since: v0.56
Pair
(defstruct Pair [A B] (fst A) (snd B))
parameterized two-element tuple with element types A and B.
Since: Phase TC1
pair
(pair [A B])
construct a Pair[A B].
| a | first element (type A) | |
| b | second element (type B) |
A Pair[A B] value.
(pair 1 2) ; => (1, 2)
Since: Phase TC1
pair-fst
(pair-fst [A B])
return the first element of a Pair[A B].
| p | Pair[A B] |
The first element of type A.
(pair-fst (pair 10 20)) ; => 10
Since: Phase TC1
pair-snd
(pair-snd [A B])
return the second element of a Pair[A B].
| p | Pair[A B] |
The second element of type B.
(pair-snd (pair 10 20)) ; => 20
Since: Phase TC1
pair-free
(pair-free [A B])
compatibility no-op for Pair[A B] values.
| p | Pair[A B] |
(pair-free my-pair)
Since: Phase TC1
pair-eq?
(pair-eq? [p1 p2 fst-cmp snd-cmp])
compare two Pair[A B] values element-wise.
| p1 | first Pair[A B] | |
| p2 | second Pair[A B] | |
| fst-cmp | comparator for first element fn [a :int b :int] :bool | |
| snd-cmp | comparator for second element fn [a :int b :int] :bool |
true if both first and second elements are equal under their comparators.
(pair-eq? (pair 1 2) (pair 1 2) (fn [a b] (= a b)) (fn [a b] (= a b))) ; => true
Since: Phase TC1
pair-eq-carrier?
(pair-eq-carrier? [A B])
legacy carrier-ABI helper used inside Pair's Eq instance.
Eq[Pair]
(definstance Eq [Pair])
element-wise equality using each component's Eq instance.