use core::strings use core::lists # Helper functions for mixed-unit conversions. See units::mixed for more. fn _zero_length(val: A) -> A = val * 0 -> val fn _mixed_unit_list(val: D, units: List, acc: List) -> List = if val == 0 then concat(acc, map(_zero_length, units)) else if len(units) == 1 then cons_end(val -> head(units), acc) else _mixed_unit_list(val - unit_val, tail(units), cons_end(unit_val, acc)) where unit_val: D = if (len(units) > 0) then (val |> trunc_in(head(units))) else error("Units list cannot be empty")