scalus.cardano.onchain.plutus.prelude.PairList
See thePairList companion enum
object PairList
Attributes
Members list
Type members
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Extensions
Extensions
extension [A, B](self: PairList[A, B])
Returns the first element of this PairList.
Returns the first element of this PairList.
Attributes
- Returns
-
The first key-value pair.
- Throws
-
NoSuchElementException
If the
PairListis empty. - Example
-
PairList.single("a", 1).head === ("a", 1)
Maps values while keeping keys unchanged.
Maps values while keeping keys unchanged.
On-chain this is significantly cheaper than List.map on tuples because it uses fstPair/sndPair builtins directly (~4 ops/element vs ~12).
Attributes
extension [A, B](self: List[(A, B)])
Converts a List[(A, B)] to a PairList[A, B].
Converts a List[(A, B)] to a PairList[A, B].
On-chain this is a zero-cost operation (noop in UPLC) because both types share the same SumDataPairList representation.
Attributes
In this article