The map-family of functions would make writing certain kinds of models easier. Because we lack closures (#2197) it would make sense to make them variadic, so a basic map would have the signature
map(f, T, ...) which would call f(T[1], ...), f(T[2], ...) etc.
A few variants of this would be useful, such as map2 which maps over two containers of the same size,
and specialized row_map/column_map for matrices, which would allow e.g.
matrix[N, K] x; // original covariates
matrix[N, K] x_std = row_map(standardize, x); // standardized covariates
(suggested by @bob-carpenter)
The map-family of functions would make writing certain kinds of models easier. Because we lack closures (#2197) it would make sense to make them variadic, so a basic
mapwould have the signaturemap(f, T, ...)which would callf(T[1], ...),f(T[2], ...)etc.A few variants of this would be useful, such as
map2which maps over two containers of the same size,and specialized
row_map/column_mapfor matrices, which would allow e.g.(suggested by @bob-carpenter)