>>108357881
in Mercury this is just
:- module ntr.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module solutions, list.
:- type boy ---> val; markus.
:- type girl ---> lydia; alice.
:- pred crushing_on(boy, girl).
:- mode crushing_on(out, in) is semidet.
crushing_on(val, lydia).
:- pred having_sex(boy, girl).
:- mode having_sex(out, out) is multi.
having_sex(markus, lydia).
having_sex(val, alice).
:- pred getting_fucked(girl).
:- mode getting_fucked(out) is multi.
getting_fucked(X) :- having_sex(_, X).
:- pred someone_else_inside_girl(girl, boy).
:- mode someone_else_inside_girl(in, in) is semidet.
someone_else_inside_girl(Y, X) :-
having_sex(P, Y),
P \= X.
:- pred heart_aches(boy).
:- mode heart_aches(out) is nondet.
heart_aches(X) :-
crushing_on(X, Y),
getting_fucked(Y),
someone_else_inside_girl(Y, X).
main(!IO) :-
solutions(heart_aches, Solutions),
( if Solutions = [] then
io.write_string("Wholesome romance.\n", !IO)
else foldl((pred(P::in, !.IO::di, !:IO::uo) is det :-
io.print(P, !IO),
io.nl(!IO)), Solutions, !IO)
).
gave val a sex partner to keep the logic from collapsing into determinism (not an error, but Mercury whines)