!7 cmodule PatternMaker { S examplesText, counterexamplesText; Set examples; transient JTable theoriesTable; record noeq Example(S text, bool pos) {} class Theory { S pattern; } visual withCenteredButtons(jvsplit( jhgrid( jCenteredSection("Examples", dm_textArea examplesText()), jCenteredSection("Counterexamples", dm_textArea counterexamplesText())), jCenteredSection("Theories", theoriesTable = sexyTable())), jThreadedButton("Think", rEnter think)); void think { Set l1 = asLinkedHashSet(tlftj(examplesText)); Set l2 = asLinkedHashSet(tlftj(counterexamplesText)); Set intersection = setIntersection(l1, l2); if (nempty(intersection)) ret with infoBox("Error: Examples appear in both lists, e.g. " + first(intersection)); setField(examples := concatAsLinkedHashSet( map(l1, s -> new Example(s, true)), map(l2, s -> new Example(s, false)))); } }