In my prolog database, I have below facts:
played('Sharon rose', piano).
played('Robert Kay', piano).
played('Kelvin Cage', drums).
singer('Robert Kay').
band_leader('Sharon rose').
I want to print out all the names uniquely as a single list.
Below is my query using setof and the output:
setof(X, (played(X,_);singer(X);band_leader(X)), Output).
Output = ['Robert Kay','Sharon rose'] ? ;
Output = ['Kelvin Cage'] ? ;
Output = ['Robert Kay','Sharon rose']
yes
However, the output isn't what I want. I want it to print out the names uniquely as a list.
Drums
to beDrums
ordrums
? – Enigmativity