APL matrix product operator
Fairly easy in julia:<p><pre><code>    julia&gt; function arbitrary_matrix_reop(bin1::Function, bin2::Function)
             (m::Matrix, v::Vector) -&gt; [
               foldr(bin2, [
                 bin1(m[row_idx, col_idx], v[col_idx])
                   for col_idx in 1:size(m,2) 
               ]) 
               for row_idx in 1:size(m,1)
             ]
           end

    arbitrary_matrix_reop (generic function with 1 method)

    julia&gt; M = [1 2 3
                4 5 6]
    julia&gt; v = [5,6,7]

    julia&gt; ⊚ = arbitrary_matrix_reop(*, +)

    julia&gt; M ⊚ v
    2-element Array{Int64,1}:
      38
      92

    julia&gt; ⊜ = arbitrary_matrix_reop(min, +)

    julia&gt; M ⊜ v
    2-element Array{Int64,1}:
      6
     15
</code></pre>
Just a first pass. Function composition (∘) is a predefined operation in julia, so that sohuld make what the author already wants pretty trivial, There are probably smart ways of doing multiple dispatch so that you can do more than just matrix-vector but also matrix-matrix, etc.<p>Edit: The author actually might want function application (|&gt;), not function composition (I&#x27;m not sure).  In that case it&#x27;s doable too:<p><pre><code>    julia&gt; M = [π    0
                π&#x2F;2 π ]

    julia&gt; v = [cos, sin]

    julia&gt; ⦷ = arbitrary_matrix_reop(|&gt;, +)

    julia&gt; M ⦷ v
    2-element Array{Float64,1}:
     -1.0                   
      1.8369701987210297e-16</code></pre>