Dinesman's multiple-dwelling problem: Difference between revisions

Content added Content deleted
Line 146: Line 146:


=={{header|Icon}} and {{header|Unicon}}==
=={{header|Icon}} and {{header|Unicon}}==
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.

<lang Icon>invocable all
<lang Icon>invocable all
global nameL, nameT, rules
global nameL, nameT, rules