# Pastebin bwRXBjJO
OLX-RJ233-WLAN:ProblemSolver fernando$ perl6 -I. -MProblem -e 'my $p = Problem.new; $p.add-variable: "A", ^10; $p.add-variable: "B", ^10; $p.constraint-vars: &infix:, ; $p.add-constraint: -> :$A!, :$B! {$A + $B == 10}; say $p.solve'
({A => 3, B => 7} {A => 1, B => 9} {A => 6, B => 4} {A => 2, B => 8} {A => 7, B => 3} {A => 9, B => 1} {A => 4, B => 6} {A => 8, B => 2})
OLX-RJ233-WLAN:ProblemSolver fernando$ git checkout -
Switched to branch 'error'
OLX-RJ233-WLAN:ProblemSolver fernando$ git diff master
diff --git a/State.pm6 b/State.pm6
index 047b417..6b6e738 100644
--- a/State.pm6
+++ b/State.pm6
@@ -4,6 +4,7 @@ use Domain;
has %.vars;
has %.found = Set.new;
has ::?CLASS $.parent;
+has Callable @.bla;
multi method add-variable(Str $name, $value) {
%!vars{$name} = $value;
OLX-RJ233-WLAN:ProblemSolver fernando$ perl6 -I. -MProblem -e 'my $p = Problem.new; $p.add-variable: "A", ^10; $p.add-variable: "B", ^10; $p.constraint-vars: &infix:, ; $p.add-constraint: -> :$A!, :$B! {$A + $B == 10}; say $p.solve'
({A => 3, B => 7} {A => 1, B => 9} {A => 6, B => 4} {A => 2, B => 8} {A => 7, B => 3} {A => 9, B => 1} {A => 4, B => 6} {A => 8, B => 2})
OLX-RJ233-WLAN:ProblemSolver fernando$ perl6 -I. -MProblem -e 'my $p = Problem.new; $p.add-variable: "A", ^10; $p.add-variable: "B", ^10; $p.constraint-vars: &infix:, ; $p.add-constraint: -> :$A!, :$B! {$A + $B == 10}; say $p.solve'
Type check failed in assignment to %!heuristics; expected Array[Callable] but got Array[Callable].new()
in method add-heuristic at /Users/fernando/ProblemSolver/Problem.pm6 (Problem) line 11
in method constraint-vars at /Users/fernando/ProblemSolver/Problem.pm6 (Problem) line 75
in block at -e line 1
OLX-RJ233-WLAN:ProblemSolver fernando$