JuliaLang/julia — pull request #2666 by stevengj (2013-03-24 22:34:37+00:00)
Title: bugfixes to mapslices: work for dims = Integer and don't evaluate f twice

This patch fixes multiple failures that occur if you do `mapslices(f, A, dim)` where `dim` is a single `Integer` rather than an array.

It also fixes a problem in which the function `f` was being evaluated twice for the first slice, which is problematic if `f` has side effects (besides being suboptimal).