Closed AzizZayed closed 1 month ago
Not currently! For now you have to write your own tuple datatype:
(datatype PairI64I64 (Pii i64 i64))
(function fst (Pairi64I64) i64)
(rule ((Pii a b)) ((set (fst (Pii a b)) a)))
...
Note that implementing pairs as built-in container types also has its limitations. For example, you cannot have (Pii a b) as part of the query if it's implemented as a built-in container.
Note that with user defined generics a pair type could be written more easily and re-used without having to redefine the rewrites for every type of pair: https://github.com/egraphs-good/egglog/issues/386
I see that there are built-in types like
Vec
,Map
andSet
. Is there a pair or tuple built-in type? The usage would be like