Maybe something like sapply_len and sapply_along so that we could express something like this:
NumericVector out(n) ;
for( int i=0; i<n; i++){
double val = ... ;
out[i] = val ;
}
This can be done in sapply with:
NumericVector out = sapply( seq_len(n), [](int i){
double val = ... ;
return val ;
}) ;
But this could be useful:
NumericVector out = sapply_len(n, [](int i){
double val = ... ;
return val ;
}) ;
Maybe something like
sapply_lenandsapply_alongso that we could express something like this:This can be done in
sapplywith:But this could be useful: