Is there a way to use closures or list comprehension when defining constant arrays in Rust? Suppose we have these three const arrays:
const K1 : [i32;8] = [100, 100, 101, 102, 104, 106, 108, 900];
const K2 : [i32;8] = [-100, -100, -101, -102, -104, -106, -108, -900];
const K3 : [i32;8] = [-900, -108, -106, -104, -102, -101, -100, -100];
In python K2 and K3 could be expressed as
K2=[-x for x in K1]
K3=[-x for x in K1[::-1]
Rust has the cute crate which emulates python list comprehension, but I don't think it can be used to define constants. So is there a more elegant solution than simply typing out K2 and K3 as above?