I'm trying to apply a function `f(x::Array{Float64, 1}) -> Array{Float64, 2}` to each row in an `m x n` array in Julia (I'm using v1.1, if it's relevant).

Now, I was hoping that I could simply apply `mapslices` as follows:

```
# toy example of f
f = (x -> randn(length(x), length(x)))
A = randn(100, 50)

# intent: apply f to every row in A and collect the result into a 100 x 50 x 50 matrix.
result = mapslices(f, A, dims=2)

```

Unfortunately, `mapslices` fails with the following message:

> 
> `ERROR: DimensionMismatch("tried to assign 2 elements to 1 destinations")`
> 
> 
> 

Is there a `mapslices` analogue for this situation? I know I can do this with a `for` loop but I was hoping for something easier.

**Update**: apparently one way to do this is to embed `A` into a 3-D array:

```
result = mapslices(f, reshape(A, (size(A)..., 1)), dims=[2, 3])

```