I am implementing a family tree using Strawberry Prolog (what the computer labs have at my school) and would like get rid of the duplicate answers. The findall function works in Strawberry Prolog which put all the answers in a list, but I believe setof does not exist with this compiler. I could either switch compilers or add the setof-function to this one. I think the latter would be a better learning experience, but I have no idea where to start.
Does anyone happen to know the code behind the setof function in other compilers and how to convert this to Strawberry Prolog? Or is there a function similar to setof already in Strawberry Prolog?
Thanks.
You can simply sort the output of findall. Of course implementing setof it’s a much more rewarding path, but definitely not simple. Here source from SWI-Prolog:
As you can see, the basic it’s always findall…