1
use uniplate::Uniplate;
2

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

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