Add `vector` macro for initialization of `Vector` with argument-defined type and length
chrissimpkins opened this issue · 0 comments
chrissimpkins commented
The approach will be similar to that used by the standard lib vec!
macro for Vec
types and will support the following initialization syntax:
Comma-delimited list of numbers with the same type
use vectora::vector;
use num::Complex;
let v_int = vector![1, 2, 3];
let v_float = vector![1.0, 2.0, 3.0];
let v_complex = vector![Complex::new(1, 2), Complex::new(-1, -2), Complex::new(-1, 2)];
[NUM; LEN] expansion syntax
use vectora::vector;
use num::Complex;
let v_int: Vector<i32, 3> = vector![1; 3];
let v_float: Vector<f64, 3> = vector![1.0; 3];
let v_complex: Vector<Complex<i32>, 3> = vector![Complex::new(1, 2); 3];