Inspired by this worthy answer to a similar problem, I decided to use fail
in the following code in order to get all the answers:
:-discontiguous(a/1),
discontiguous(aOnly/1),
discontiguous(dark_eyes/1),
discontiguous(pretty_face/1),
discontiguous(pigmented/1),
discontiguous(bleached_a/1).
a(adriana_chechik).
a(alysa_gap).
a(anna_de_ville).
dark_eyes(anna_de_ville).
pigmented(anna_de_ville).
a(aurora_jolie).
aOnly(aurora_jolie).
dark_eyes(aurora_jolie).
pretty_face(aurora_jolie).
pigmented(aurora_jolie).
dark_eyes(autumn_falls).
pretty_face(autumn_falls).
bleached_a(autumn_falls).
a(casey_calvert).
dark_eyes(casey_calvert).
pretty_face(casey_calvert).
pigmented(casey_calvert).
a(dahlia_sky).
a(dominica_lito).
dark_eyes(ella_knox).
pretty_face(ella_knox).
pigmented(ella_knox).
a(holly_hendrix).
dark_eyes(holly_hendrix).
pigmented(holly_hendrix).
a(isabella_clark).
dark_eyes(jade_kush).
pretty_face(jade_kush).
a(juelz_ventura).
dark_eyes(kapri_styles).
pigmented(kapri_styles).
dark_eyes(kristina_milan).
pretty_face(kristina_milan).
a(kylie_sinner).
aOnly(kylie_sinner).
dark_eyes(kylie_sinner).
pretty_face(kylie_sinner).
a(leigh_raven).
dark_eyes(leigh_raven).
pretty_face(leigh_raven).
dark_eyes(maserati).
pretty_face(maserati).
dark_eyes(miosotis).
pretty_face(miosotis).
dark_eyes(scarlett_bloom).
pretty_face(scarlett_bloom).
pigmented(scarlett_bloom).
pigmented(sheena_shaw).
dark_eyes(sofia_rose).
pretty_face(sofia_rose).
a(teanna_trump).
dark_eyes(teanna_trump).
pigmented(teanna_trump).
a(veronica_avluv).
a(yudi_pineda).
dark_eyes(yudi_pineda).
pretty_face(yudi_pineda).
:- initialization main.
main:-
a(X),
pretty_face(X),
print(X), nl,
fail.
Now, the issue that still remains is that the output to the command swipl -q -s /home/jim/CS/SoftwareDevelopment/MySoftware/Racket/porn/females-by-Racket.pl -g main
(where females-by-Racket.pl
is the file with the above code) looks like so:
aurora_jolie
casey_calvert
kylie_sinner
leigh_raven
yudi_pineda
Warning: /home/jim/CS/SoftwareDevelopment/MySoftware/Racket/porn/females-by-Racket.pl:68: Initialization goal failed
aurora_jolie
casey_calvert
kylie_sinner
leigh_raven
yudi_pineda
My fix for this is swipl -q -s /home/jim/CS/SoftwareDevelopment/MySoftware/Racket/porn/females-by-Racket.pl -g main 2>/dev/null|sort -u
where the warning is redirected to /dev/null
and the duplicate answers are removed with sort -u
.
1. Why does my code produce duplicate answers?
2. Is it doable to accomplish what I did by appending 2>/dev/null|sort -u
to the command but only do it within Prolog? I.e. without modifying the output afterwards with other tools.
Please let any interactive solutions that involve REPL be outside of the scope of this question.