Zebra puzzle: Difference between revisions

Content deleted Content added
→‎{{header|Perl 6}}: rename consider() -> choices()
m →‎{{header|Perl 6}}: tweak solve() muti subs
Line 4,916:
 
#| found a solution that fits all the facts
multi sub solve(@housessolution, @facts [ ]) {
take @housessolution;
}
 
#| processextend a scenario to cover the next fact
multi sub solve(@housesscenario, [ $fact, *@facts ] is copy) {
for gather choices(@housesscenario, |$fact) {
my $fact = @facts.shift;
for gather choices(@houses, |$fact) {
solve(@$_, @facts)
}