Fortran has elemental functions.

This means that you can define a function for *primitive* types (int, double…) and they will automatically work for vectors and matrices that contain these primitive types.

Consider the *elemental* function `pos(x::Number) = x < 0 ? zero(x) : x`

This is the closest I get using Julia:

```
pos(x) = reshape([pos(x[i]) for i = 1:length(x)],size(x))
```

Now `pos`

works for scalars of type `Number`

, vectors, matrices, ranges…

Are there alternatives?