You can avoid using this by writing something more verbose. If I rewrite Stefan's predicate:
implication(X) :- ( X = a, write('Argument a received.'), nl ; X = b, write('Argument b received.'), nl ; X \= a, X \= b, write('Received unknown argument.'), nl ).
(Yes, I do not think there are any problems with its use, but for some reason my boss was paranoid, so we always used the above approach.)
In any version, you must be careful to cover all the cases that you intend to cover, especially if you have many branches.
ETA: I'm not sure if this is completely equivalent to Stephan's, due to indentation if you have implication(X) . But I do not have a Prolog interpreter to check.
pfctdayelise
source share