1
use uniplate::Uniplate;
2

            
3
use crate::{Reduction, Rule};
4

            
5
37
pub fn select_first<T, M, R>(
6
37
    _: &T,
7
37
    rs: &mut dyn Iterator<Item = (&R, Reduction<T, M>)>,
8
37
) -> Option<Reduction<T, M>>
9
37
where
10
37
    T: Uniplate,
11
37
    R: Rule<T, M>,
12
37
{
13
37
    rs.next().map(|(_, r)| r)
14
37
}
15

            
16
// TODO: Add more selection strategies (e.g. random, smallest subtree, ask the user for input, etc.)
17
// The engine will also have to use a new function which only calls a selector function if there is >1 result