Commit | Line | Data |
---|---|---|
55131db4 | 1 | package DX::Step::Backtrack; |
2 | ||
3 | use DX::Class; | |
4 | ||
5 | with 'DX::Role::Step'; | |
6 | ||
7 | sub apply_to { | |
8 | my ($self, $ss) = @_; | |
9 | my ($first_alt, @rest_alt) = @{$ss->alternatives}; | |
6a0483ff | 10 | return $ss->but(next_step => $ss->on_exhaustion_step) unless $first_alt; |
55131db4 | 11 | return $ss->but( |
12 | current_hypothesis => $first_alt->[0], | |
13 | alternatives => \@rest_alt, | |
14 | next_step => $first_alt->[1], | |
282b1d76 | 15 | is_solution_state => 0, |
55131db4 | 16 | ); |
17 | } | |
18 | ||
19 | 1; |