1 | //! Map functionality. |
---|---|
2 | |
3 | use super::{Relation, Variable}; |
4 | |
5 | pub(crate) fn map_into<T1: Ord, T2: Ord>( |
6 | input: &Variable<T1>, |
7 | output: &Variable<T2>, |
8 | logic: impl FnMut(&T1) -> T2, |
9 | ) { |
10 | let results: Vec<T2> = input.recent.borrow().iter().map(logic).collect(); |
11 | |
12 | output.insert(Relation::from_vec(elements:results)); |
13 | } |
14 |