The ith element of a list is M[[i]]. An expression ending in & is a lambda function, with # being the first parameter. f /@ B is equivalent to map(f, B) (f is applied to each element of B). If[# == 0, 0, 1] is equivalent to lambda x: x==0 ? 0 : 1

So to me, it looks like:

m2 = [m[2][i] for i in [x[2] for x in m[3]]
m3 = [m2[i] for i in [x[2] for x in m[4]]
lM = [[0 if i==0 else 1 for i in x] for x in m3]

There's a decent chance that I missed something, though. It's been a long while since I did anything in mathematica, and I've realized that mathematica quickly starts looking like line noise after I've stopped using it.

Thanks,

Jason

P.S. I was curious about the online mathematica the other night. If I understood the marketing material correctly, it seems you get interactive computation included in the base price, and you are charged for offline computation. I checked the prices, and saw that the credit system they offer sells computational time for about $10.80/hour (in $15 increments), down to $6.47/hour (if you buy $180 at a time), billed in 100ms chunks [1]. In comparison, the highest price an Amazon Linux EC2 On Demand instance is a 32 processor, 244GB Ram, 8 800GB SSD instance for $6.82/hour. I realize I didn't count Amazon's bandwidth charges ($0.12/GB after 1GB out from EC2 to internet each month), but regardless, that seems like relatively expensive computational time.

[1] http://www.wolfram.com/cloud-credits/ (down at the bottom)
[2] http://aws.amazon.com/ec2/pricing/



On 11/21/14, 20:45, William Stein wrote:

On Nov 21, 2014 11:46 AM, "Dr. David Kirkby (Kirkby Microwave Ltd)"
<drkir...@kirkbymicrowave.co.uk <mailto:drkir...@kirkbymicrowave.co.uk>>
wrote:
 >
 >
 > On 18 Nov 2014 22:37, "Stefan" <stefanvanz...@gmail.com
<mailto:stefanvanz...@gmail.com>> wrote:
 > >
 > > I don't know if I simply lack the appropriate Mathematica
knowledge, but years ago, when I implemented matroids
 > > lM = Map[If[# == 0, 0, 1] &, M[[2]][[#[[2]] & /@ M[[3]], #[[2]] &
/@ M[[4]]]], {2}];
 >
 > I am no expert on Mathematica, but Mathematica code does not need to
be so cryptic.
 >

Can anybody rewrite the above line of mathematica code so that it does
something equivalent, but is less cryptic?

 > Anyway,  is it any less readable than this code to plot the
Mandelbrot set?
 >
 >
http://preshing.com/20110926/high-resolution-mandelbrot-in-obfuscated-python/
 >
 > Or this C code
 >
 > http://www.ioccc.org/2013/birken/birken.c
 >
 > Dave.
 >
 > --
 > You received this message because you are subscribed to the Google
Groups "sage-devel" group.
 > To unsubscribe from this group and stop receiving emails from it,
send an email to sage-devel+unsubscr...@googlegroups.com
<mailto:sage-devel%2bunsubscr...@googlegroups.com>.
 > To post to this group, send email to sage-devel@googlegroups.com
<mailto:sage-devel@googlegroups.com>.
 > Visit this group at http://groups.google.com/group/sage-devel.
 > For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sage-devel+unsubscr...@googlegroups.com
<mailto:sage-devel+unsubscr...@googlegroups.com>.
To post to this group, send email to sage-devel@googlegroups.com
<mailto:sage-devel@googlegroups.com>.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to