package DX::Predicate::Eq;
-use DX::Utils qw(step rspace res CONTENTS_OF);
+use DX::Utils qw(rspace res CONTENTS_OF);
use DX::Class;
with 'DX::Role::Predicate';
package DX::ResolutionSpace;
-use DX::Utils qw(step);
use DX::Step::Backtrack;
+use DX::Step::ResolveProposition;
use DX::Class;
has proposition => (is => 'ro');
sub next_step {
my ($self) = @_;
return DX::Step::Backtrack->new unless @{$self->members};
- return step(
- resolves => $self->proposition,
- resolution_space => $self,
- );
+ return DX::Step::ResolveProposition->new(resolution_space => $self);
}
1;
package DX::Role::Predicate;
-use List::Util qw(reduce);
-use DX::Utils qw(step CONTENTS_OF);
use DX::Role;
sub resolution_step_for {
use DX::Step::Backtrack;
use Types::Standard qw(ArrayRef);
-use DX::Utils qw(deparse step);
use DX::Class;
with 'DX::Role::Step';
-has resolves => (is => 'ro', isa => Proposition);
+has resolves => (is => 'lazy', init_arg => undef, builder => sub {
+ my ($self) = @_;
+ $self->resolution_space->proposition;
+});
has resolution_space => (is => 'ro', isa => ResolutionSpace);
my ($self) = @_;
my $rspace = $self->resolution_space->remaining_resolution_space;
return undef unless @{$rspace->members};
- return step(
- resolves => $self->resolves,
- resolution_space => $rspace
- );
+ return $rspace->next_step;
});
sub but_first {
our @EXPORT_OK = (
@const,
- (my @builders = qw(step rspace rstrat res string number dict proposition)),
+ (my @builders = qw(rspace rstrat res string number dict proposition)),
'deparse', '*trace',
);
[ map _expand_dep($_), @{$_[0]} ]
}
-sub step {
- require DX::Step::ResolveProposition;
- my %args = @_;
- DX::Step::ResolveProposition->new(
- %args,
- depends_on => _expand_deps($args{depends_on}),
- );
-}
-
sub rspace {
require DX::ResolutionSpace;
DX::ResolutionSpace->new(@_);