For today I have switched to this style:
This comes from Elm (for example: groceries ) and I also saw it somewhere on Rosettacode.
express2_dl(Tip,Fin,Str) :-
Tip =@= Fin % "structurally equal"
,var(Fin) % and this must also be true
,!
,Str="Empty difflist: ∅"
.
… turns out to be relatively neat as you can easily remove or add lines, check whether commas and dots are there and whether there is a ; lurking in the jungle of the suffixes.
It is just a bit sad that the compiler doesn’t like a comma before the first conjunctive element (which is the cut a conjunctive element btw, it should be in comma position?), that would be even neater:
express2_dl(Tip,Fin,Str) :-
,Tip =@= Fin % "structurally equal"
,var(Fin) % and this must also be true
,!
,Str="Empty difflist: ∅"
.
Just gives
Syntax error: Operator expected
Curses!
(Btw, I thought SWI-Prolog indexes clauses on more than the first argument? I found that adding an integer as first argument makes my program semideterministic. Moved the integer argument to the last position immediately.)