From: Matt S Trout Date: Mon, 16 Apr 2018 02:25:14 +0000 (+0000) Subject: skip backtracking rspaces with no alternatives left X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b63c427e5f7bf56fce5308a970a7402a4d62e0d4;p=scpubgit%2FDX.git skip backtracking rspaces with no alternatives left --- diff --git a/fragment.output/btdemo b/fragment.output/btdemo index c75951e..f42caa6 100644 --- a/fragment.output/btdemo +++ b/fragment.output/btdemo @@ -244,13 +244,6 @@ recheck eq ?X {{ a 1 b 2 c 3 }} { } backtrack remaining resolution_space { - proposition member_at Y ?YKey ?YValue - geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue } - aperture { VALUE_SET 0.YKey; VALUE_SET 0.YValue } - members { } -} -backtrack -remaining resolution_space { proposition member_at X ?XKey ?XValue geometry_depends_on { INDICES_OF 0.X; TYPE_OF 0.XKey; TYPE_OF 0.XValue } aperture { VALUE_SET 0.XKey; VALUE_SET 0.XValue } @@ -340,13 +333,6 @@ recheck eq ?Y {{ d 1 e 2 f 3 }} { } backtrack remaining resolution_space { - proposition eq XValue 2 - geometry_depends_on { CONTENTS_OF 0.XValue } - aperture { VALUE_SET 0.XValue; VALUE_SET 0.X.b } - members { } -} -backtrack -remaining resolution_space { proposition member_at Y ?YKey ?YValue geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue } aperture { VALUE_SET 0.YKey; VALUE_SET 0.YValue } @@ -448,20 +434,6 @@ recheck eq ?Y {{ d 1 e 2 f 3 }} { } backtrack remaining resolution_space { - proposition eq XValue 2 - geometry_depends_on { CONTENTS_OF 0.XValue } - aperture { VALUE_SET 0.XValue; VALUE_SET 0.X.b } - members { } -} -backtrack -remaining resolution_space { - proposition member_at Y ?YKey ?YValue - geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue } - aperture { VALUE_SET 0.YKey; VALUE_SET 0.YValue } - members { } -} -backtrack -remaining resolution_space { proposition member_at X ?XKey ?XValue geometry_depends_on { INDICES_OF 0.X; TYPE_OF 0.XKey; TYPE_OF 0.XValue } aperture { VALUE_SET 0.XKey; VALUE_SET 0.XValue } @@ -650,34 +622,6 @@ recheck eq ?X {{ a 1 b 2 c 3 }} { fail_recheck } backtrack -remaining resolution_space { - proposition member_at Y ?YKey ?YValue - geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue } - aperture { VALUE_SET 0.YKey; VALUE_SET 0.YValue } - members { } -} -backtrack -remaining resolution_space { - proposition member_at X ?XKey ?XValue - geometry_depends_on { INDICES_OF 0.X; TYPE_OF 0.XKey; TYPE_OF 0.XValue } - aperture { VALUE_SET 0.XKey; VALUE_SET 0.XValue } - members { } -} -backtrack -remaining resolution_space { - proposition eq ?Y {{ d 1 e 2 f 3 }} - geometry_depends_on { CONTENTS_OF 0.Y } - aperture { VALUE_SET 0.Y } - members { } -} -backtrack -remaining resolution_space { - proposition eq ?X {{ a 1 b 2 c 3 }} - geometry_depends_on { CONTENTS_OF 0.X } - aperture { VALUE_SET 0.X } - members { } -} -backtrack {{ X {{ a 1 b 2 c 3 }} XKey 'b' diff --git a/lib/DX/Step/Backtrack.pm b/lib/DX/Step/Backtrack.pm index 865073a..9a92677 100644 --- a/lib/DX/Step/Backtrack.pm +++ b/lib/DX/Step/Backtrack.pm @@ -11,6 +11,7 @@ sub apply_to { trace backtrack => [ statement => [ [ symbol => 'backtrack' ] ] ]; foreach my $adj (@{$ss->decisions_taken}) { my ($rspace_was, $ss_was) = @$adj; + next unless @{$rspace_was->remaining_resolution_space->members}; trace rspace => [ statement => [ [ symbol => 'remaining' ], @{$rspace_was->remaining_resolution_space->for_deparse->[1]}