Dinesman's multiple-dwelling problem: Difference between revisions

m
m (→‎Using the Amb operator: Modify headings)
Line 148:
This solution uses string invocation to call operators and the fact the Icon/Unicon procedures are first class values. The procedure names could also be given as strings and it would be fairly simple to read the names and all the rules directly from a file. Each name and rule recurses and relies on the inherent backtracking in the language to achieve the goal.
 
The rules explicitly call stop() after showing the solution. Removing the ''[stop]'' would cause the solver to try all possible cases and report all possible solutions (if there were multiple ones).
 
<lang Icon>invocable all
Anonymous user