B:BD[
2.2744] → [
2.2744:2948]
pub fn sublist<T: PartialEq>(_first_list: &[T], _second_list: &[T]) -> Comparison {
unimplemented!("Determine if the first list is equal to, sublist of, superlist of or unequal to the second list.");
/// Determines if `b` is a sublist of `a`.
///
/// # Arguments:
/// * `a`: Slice to test if is a superlist of `b`.
/// * `b`: Slice to test if is a sublist of `a`.
///
/// # Examples
/// ```rust
/// # use sublist::*;
/// assert!(is_sublist(&[1, 2, 3], &[1, 2]));
/// assert!(!is_sublist(&[1, 2, 3], &[1, 3]));
/// ```
pub fn is_sublist<T: PartialEq + Sync>(a: &[T], b: &[T]) -> bool {
a.par_windows(b.len()).any(|sublist| sublist == b)
}
pub fn sublist<T: PartialEq + Sync>(_first_list: &[T], _second_list: &[T]) -> Comparison {
match _first_list.len().cmp(&_second_list.len()) {
Ordering::Less => {
if _first_list.is_empty() || is_sublist(_second_list, _first_list) {
return Comparison::Sublist;
}
}
Ordering::Equal => {
if _first_list == _second_list {
return Comparison::Equal;
}
}
Ordering::Greater => {
if _second_list.is_empty() || is_sublist(_first_list, _second_list) {
return Comparison::Superlist;
}
}
}
Comparison::Unequal