-
Suggestion
-
Resolution: Unresolved
-
None
-
None
The Confluence "code" block does not support Prolog. Please add it (not sure how difficult that is though; or is there a way to wire up one's own?).
Inappropriate syntax highlighting ensues and one has to manually set the style to "plain text" (because the widget's attempt at doing something useful fails), or maybe "Erlang" which is kinda, sorta similar.
Example (here, in Jira, but I suppose the underlying widget is the same as the one in Confluence. The style is set to "java".
From https://rosettacode.org/wiki/100_doors#Prolog
main :- forall(between(1,100,Door), ignore(display(Door))). % show output if door is open after the 100th pass display(Door) :- status(Door, 100, open), format("Door ~d is open~n", [Door]). % true if Door has Status after Pass is done status(Door, Pass, Status) :- Pass > 0, Remainder is Door mod Pass, toggle(Remainder, OldStatus, Status), OldPass is Pass - 1, status(Door, OldPass, OldStatus). status(_Door, 0, closed). toggle(Remainder, Status, Status) :- Remainder > 0. toggle(0, open, closed). toggle(0, closed, open).