use std::ops::Range;
use vortex_array::ArrayRef;
use vortex_array::ArrayView;
use vortex_array::IntoArray;
use vortex_array::arrays::slice::SliceReduce;
use vortex_error::VortexResult;
use crate::FoR;
use crate::r#for::array::FoRArrayExt;
impl SliceReduce for FoR {
fn slice(array: ArrayView<'_, Self>, range: Range<usize>) -> VortexResult<Option<ArrayRef>> {
Ok(Some(
FoR::try_new(
array.encoded().slice(range)?,
array.reference_scalar().clone(),
)?
.into_array(),
))
}
}