actions { SetValue 0.X {{ a 1 b 2 c 3 }} }
depends_on { CONTENTS_OF 0.X }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.X }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.XValue }
remaining resolution_space {
proposition member_at Y ?YKey ?YValue
geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue }
actions { SetValue 0.X {{ a 1 b 2 c 3 }} }
depends_on { CONTENTS_OF 0.X }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.X }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.XValue }
remaining resolution_space {
proposition member_at Y ?YKey ?YValue
geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue }
actions { SetValue 0.X {{ a 1 b 2 c 3 }} }
depends_on { CONTENTS_OF 0.X }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.X }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.XValue }
remaining resolution_space {
proposition member_at X ?XKey ?XValue
geometry_depends_on { INDICES_OF 0.X; TYPE_OF 0.XKey; TYPE_OF 0.XValue }
actions { SetValue 0.Y {{ d 1 e 2 f 3 }} }
depends_on { CONTENTS_OF 0.Y }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.Y }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.YValue }
remaining resolution_space {
proposition member_at Y ?YKey ?YValue
geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue }
actions { SetValue 0.Y {{ d 1 e 2 f 3 }} }
depends_on { CONTENTS_OF 0.Y }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.Y }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.YValue }
remaining resolution_space {
proposition member_at X ?XKey ?XValue
geometry_depends_on { INDICES_OF 0.X; TYPE_OF 0.XKey; TYPE_OF 0.XValue }
actions { SetValue 0.X {{ a 1 b 2 c 3 }} }
depends_on { CONTENTS_OF 0.X }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.X }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.XValue }
remaining resolution_space {
proposition member_at Y ?YKey ?YValue
geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue }
actions { SetValue 0.X {{ a 1 b 2 c 3 }} }
depends_on { CONTENTS_OF 0.X }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.X }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.XValue }
remaining resolution_space {
proposition member_at Y ?YKey ?YValue
geometry_depends_on { INDICES_OF 0.Y; TYPE_OF 0.YKey; TYPE_OF 0.YValue }
actions { SetValue 0.X {{ a 1 b 2 c 3 }} }
depends_on { CONTENTS_OF 0.X }
}
- backtrack
+ backtrack because { CONTENTS_OF 0.X }
fail_recheck
}
-backtrack
+backtrack because { CONTENTS_OF 0.XValue }
{{
X {{ a 1 b 2 c 3 }}
XKey 'b'
package DX::Step::Backtrack;
+use DX::DependencyMap;
+use DX::Utils qw(format_deps);
use DX::Class;
with 'DX::Role::Step';
-#has resolution_space => (is => 'ro', isa => ResolutionSpace, required => 1);
+has resolution_space => (is => 'ro', isa => ResolutionSpace, required => 1);
sub apply_to {
my ($self, $ss) = @_;
- trace backtrack => [ statement => [ [ symbol => 'backtrack' ] ] ];
+ my $rspace = $self->resolution_space;
+ trace backtrack => [ statement => [
+ [ symbol => 'backtrack' ],
+ [ statement => [
+ [ symbol => 'because' ],
+ format_deps($rspace->geometry_depends_on)
+ ] ]
+ ] ];
+ my $dmap = DX::DependencyMap->new_empty
+ ->with_dependencies_for(
+ backtrack => $rspace->geometry_depends_on
+ );
+
foreach my $adj (@{$ss->decisions_taken}) {
my ($rspace_was, $ss_was) = @$adj;
+ $dmap = $dmap->with_dependencies_for(
+ backtrack => $rspace_was->geometry_depends_on
+ );
next unless @{$rspace_was->remaining_resolution_space->members};
trace rspace => [ statement => [
[ symbol => 'remaining' ],
our @EXPORT_OK = (
@const,
(my @builders = qw(rspace rstrat res string number dict proposition)),
- 'deparse', '*trace', 'expand_deps',
+ 'deparse', '*trace', 'expand_deps', 'format_deps',
);
our %EXPORT_TAGS = (
[ map _expand_dep($_), @{$_[0]} ]
}
+sub format_deps {
+ [ block => [
+ map [ statement => [
+ [ symbol => (split '::', ${$_->[0]})[-1] ],
+ [ value_path => [ @{$_}[1..$#$_] ] ]
+ ] ], @{$_[0]}
+ ] ]
+}
+
sub rspace {
require DX::ResolutionSpace;
DX::ResolutionSpace->new(@_);