Open AdiHarif opened 1 month ago
Hi, a good explanation of ADT representation is still missing from the docs.
You can refer to https://github.com/souffle-lang/souffle/issues/2055#issuecomment-917902328
And yes, ADT branches are indexed by alphabetical order.
Thanks! Is there a reason for indexing these branching alphabetically?
I was trying to define functors that receive ADTs as parameters and couldnt find any documentation about it.
From the tests in this repo i figured that when unpacking an ADT value in the functor implementation, the first value of the returned array is the constructors ordinal number (given that there is at least one parameterized constructor). I assumed that this ordinal value is according to constructors' declaration order, however found out that it is according to alphabetical order.
Is this by design? to be honest i find it somewhat not intuitive...
Example Souffle program:
Functor Implementation:
Output: