2 Replies
Talk map be cheap, but I'm not sure what your question is without some explanatory text
Two operators are in the same group if they produce the same output for all possible combinations of input?
So, just
GroupBy(row => (row.Left, row.Right, row.Result))
?
GroupBy returns a collection of IGrouping objects, which have a Key property (the tuple we constructed in the GroupBy call), and it implements IEnumerable letting you loop through the group's members
Each of the group's members is a Row object here
Easiest is just to run it in the debugger and have a poke around in the Watch window
What does that output?
Ah, you're not looking for operators which have the same output for all inputs
You don't have a type anywhere which is "an operator, and all its combinations of inputs and outputs"
You can solve it using linq for sure
You need to group by an object which captures all of the combinations of input and output, and compares equal if all of those are the same
Since your Row objects are sorted (for each operator), you could ignore the inputs and just look at the results (since everything's always in the same order). So two operators are in the same group of the Results of their Rows are the same in the same order (SequenceEquals)
I think you need to represent a truth table for each operator
Rather than bunging all of the rows for all operators together
Then two operators are grouped together if their truth tables are equal, as I said
Right, and now write code to compare two truth tables and see whether they're equal
(That would be easier if TruthTable
was its own type, but whatever)
I mean, sure. That doesn't change what you need to do, though
Not sure I understand the point of removing all of your messages? Just makes me look like I'm talking to myself...!
But glad you (presumably?) got it working!ChatGPT solved it. 🙂