On Saturday, September 3, 2016 at 4:13:20 PM UTC+2, Andrew Dabrowski wrote:
>
> But what about nested pattern matching, or destructuring, isn't that much 
> easier in Mathematica than Julia?  For example defining a function of two 
> lists by
> f[{w_,x_}, {y_,z_}]:=x y/(w+z).
>
> I remember reading the Julia manifesto a few years ago, where the stated 
> goal was to create a single computing language that would replace Fortran, 
> scipy, Mathematica, Matlab, etc. simultaneously.  I thought at the time 
> that it sounded nuts. 
>
> Can we all agree now that it was, in fact, nuts? 
>

This is already implemented in SJulia:

  sjulia 1> f([w_,x_], [y_,z_]) := x * y/(w+z)

  sjulia 2> f([a,b],[c,d])

  Out(2) = b*c*((a + d)^(-1))

I have implemented several of Mma's pattern matching features. But, Mma's 
pattern matching is sophisticated. I have not implemented, for instance, 
associative-commutative matching, which Mma considers "structural" 
matching.  I experimented a bit with using SJulia features from julia.  
Without looking at it now, I guess it would take some work to access the 
pattern matching.

Maybe you can also do this kind of destructuring matching with this

 https://github.com/toivoh/PatternDispatch.jl

which aims to add pattern matching to method dispatch.

Reply via email to