How to safety cast raw Map to Map<String, List<Int>> in Kotlin?

I need a function which will cast Map to Map<String, List<Int>> Currently I use unsafe "as" but I receive a fair warning about it. I want to fix it. For list part I was able to implement function inline fun <reified T : Any> List<*>.checkItemsAre(): List<T> { return this.filterIsInstance<T>().takeIf { it.size == this.size } ?:… Read More How to safety cast raw Map to Map<String, List<Int>> in Kotlin?

More sound approach to designing a spline functor?

I have made the following definition of a spline data structure: #[derive(Clone, Debug)] pub struct BSpline { knots: Vec<f32>, control_points: Vec<Vec3>, /// Internal helper variable. Used to optimize repetetitive samplings on close /// $t$ values. last_t_index: usize, order: usize, } impl BSpline { pub fn sample(&self, t: f32) -> Vec3 { debug_assert!(self.control_points.len() >= self.order); let… Read More More sound approach to designing a spline functor?