macro_rules! expr { ($([$([$([$([$([$($x:expr),* $(,)?]),+ $(,)?]),+ $(,)?]),+ $(,)?]),+ $(,)?]),+ $(,)?) => { ... }; ($([$([$([$([$($x:expr),* $(,)?]),+ $(,)?]),+ $(,)?]),+ $(,)?]),+ $(,)?) => { ... }; ($([$([$([$($x:expr),* $(,)?]),+ $(,)?]),+ $(,)?]),+ $(,)?) => { ... }; ($([$([$($x:expr),* $(,)?]),+ $(,)?]),+ $(,)?) => { ... }; ($([$($x:expr),* $(,)?]),+ $(,)?) => { ... }; ($($x:expr),* $(,)?) => { ... }; ([[[[[$elem:expr; $i:expr]; $j:expr]; $k:expr]; $l:expr]; $m:expr]; $n:expr) => { ... }; ([[[[$elem:expr; $i:expr]; $j:expr]; $k:expr]; $l:expr]; $m:expr) => { ... }; ([[[$elem:expr; $i:expr]; $j:expr]; $k:expr]; $l:expr) => { ... }; ([[$elem:expr; $i:expr]; $j:expr]; $k:expr) => { ... }; ([$elem:expr; $i:expr]; $j:expr) => { ... }; ($elem:expr; $i:expr) => { ... }; }
Expand description
Creates a multidimensional array view containing the arguments.
This macro is used to create an array view, similar to the vec! macro for vectors.
There are two forms of this macro:
- Create an array view containing a given list of elements:
use mdarray::{expr, expr::Expr};
let a = expr![[1, 2], [3, 4]];
assert_eq!(a, Expr::from(&[[1, 2], [3, 4]]));- Create an array view from a given element and shape:
use mdarray::{expr, expr::Expr};
let a = expr![[1; 2]; 3];
assert_eq!(a, Expr::from(&[[1; 2]; 3]));In the second form, the argument must be an array repeat expression with constant shape.