No matching definitions.

tur/pair

stdlib/pair.tur

typed Pair[A B]: parameterized two-element tuple.

Since: Phase TC1-F

defstruct

Pair

(defstruct Pair [A B])

parameterized two-element tuple with element types A and B.

Since: Phase TC1

defn

pair

(pair [A B])

construct a Pair[A B].

afirst element (type A)
bsecond element (type B)

A Pair[A B] value.

(pair 1 2)  ; => (1, 2)

Since: Phase TC1

defn

pair-fst

(pair-fst [A B])

return the first element of a Pair[A B].

pPair[A B]

The first element of type A.

(pair-fst (pair 10 20))  ; => 10

Since: Phase TC1

defn

pair-snd

(pair-snd [A B])

return the second element of a Pair[A B].

pPair[A B]

The second element of type B.

(pair-snd (pair 10 20))  ; => 20

Since: Phase TC1

defn

pair-free

(pair-free [A B])

compatibility no-op for Pair[A B] values.

pPair[A B]
(pair-free my-pair)

Since: Phase TC1

defmacro

pair-eq?

(pair-eq? [p1 p2 fst-cmp snd-cmp])

compare two Pair[A B] values element-wise.

p1first Pair[A B]
p2second Pair[A B]
fst-cmpcomparator for first element fn [a :int b :int] :bool
snd-cmpcomparator 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

defn

pair-eq-carrier?

(pair-eq-carrier? [p1 :int p2 :int fst-cmp snd-cmp])

legacy carrier-ABI helper used inside Pair's Eq instance.

definstance

Eq[Pair]

(definstance Eq [Pair])

element-wise equality using each component's Eq instance.