Differentiable vectorized piecewise function in Julia?

Linking related thread that seems to address the differentiable part.

As for the vectorization, f.(x) should work above?