title: What is idiomatic Julia style for by column or row operations?
body: <p>Apologies if this rather general - albeit still a coding question. </p>
  
  <p>With a bit of time on my hands I've been trying to learn a bit of <code>Julia</code>. I thought a good start would be to copy the <code>R</code> <code>microbenchmark</code> function - so I could seamlessly compare R and Julia functions.</p>
  
  <p>e.g. this is <code>microbenchmark</code> output for 2 R functions that I am trying to emulate:</p>
  
  <pre><code>Unit: seconds
  expr                    min        lq    median        uq        max      neval
  vectorised(x, y)    0.2058464 0.2165744 0.2610062 0.2612965  0.2805144     5
  devectorised(x, y)  9.7923054 9.8095265 9.8097871 9.8606076 10.0144012     5
  </code></pre>
  
  <p>So thus far in Julia I am trying to write idiomatic and hopefully understandable/terse code. Therefore I replaced a double loop with a list comprehension to create an array of timings, like so:</p>
  
  <pre><code>function timer(fs::Vector{Function}, reps::Integer)
  #    funs=length(fs)
  #    times = Array(Float64, reps, funs)
  #    for funsitr in 1:funs
  #        for repsitr in 1:reps
  #            times[reps, funs] = @elapsed fs[funs]()
  #        end
  #    end
  
      times= [@elapsed fs[funs]() for   x=1:reps, funs=1:length(fs)]
      return times
  end
  </code></pre>
  
  <p>This gives an array of timings for each of 2 functions:</p>
  
  <pre><code>julia&gt; test=timer([vec, devec], 10)
  10x2 Array{Float64,2}:
   0.231621  0.173984
   0.237173  0.210059
   0.26722   0.174007
   0.265869  0.208332
   0.266447  0.174051
   0.266637  0.208457
   0.267824  0.174044
   0.26576   0.208687
   0.267089  0.174014
   0.266926  0.208741
  </code></pre>
  
  <p>My question (finally) is how do I <strong>idiomatically</strong> apply a function such as <code>min</code>, <code>max</code>, <code>median</code> across columns (or rows) of an array without using a loop? </p>
  
  <p>I can of course do it easily for this simple case with a loop (sim to that I crossed out above)- but I can't find anything in the docs which is equivalent to say <code>apply(array,1, fun)</code> or even <code>colMeans</code>.</p>
  
  <p>The closest generic sort of function I can think of  is </p>
  
  <pre><code>julia&gt; [mean(test[:,col]) for col=1:size(test)[2]]
  2-element Array{Any,1}:
   0.231621
   0.237173
  </code></pre>
  
  <p>.. but the syntax really really doesn't appeal. Is there a more natural way to <code>apply</code> functions across columns or rows of a multidimensional array in Julia?</p>