Set Operations in Visual Prolog
Posted: 28 Apr 2023 3:23
I have:
And I am struggling with a take. Conceptually it should be something like one of those below.
I could push the elements into an array, and then walk them to remove those found. - But I was hoping for a more native solution.
Related: Any plan to add Linq to your implementation? Or even helps(Person,Modifier).ToArray().
Code: Select all
helps(Person,Modifier) :- high(Person,Taxon),decreases(Modifier,Taxon).
helps(Person,Modifier) :- low(Person,Taxon),increases(Modifier,Taxon).
hurts(Person,Modifier) :- low(Person,Taxon),decreases(Modifier,Taxon).
hurts(Person,Modifier) :- high(Person,Taxon),increases(Modifier,Taxon).
Code: Select all
take(Person,Modifier):- exclude(helps(Person,Modifier),=,hurts(Person,Modifier)).
take(Person,Modifier):- remove(helps(Person,Modifier),is,hurts(Person,Modifier)).
take(Person,Modifier):- except(helps(Person,Modifier),hurts(Person,Modifier)).
Related: Any plan to add Linq to your implementation? Or even helps(Person,Modifier).ToArray().