Apart from being an excellent programming language, it's also the best numeric/symbolic/visualization tool available. I have also worked with Matlab and MathCad, and they are below mathematica in almost every respect.
Ok, now for the flaws from the programming perspective. I can see only one - no (explicit) support for lazy lists. I.e. if you want to generate a list of odd numbers less than 100, you can write
Select[Table[i,{i,100}], OddQ]
(ok, this is suboptimal since odd numbers can be generated by
2*i-1
for suitable range of i
). I can't know how does it work internally but my guess (based on the time and memory consumption in much larger example) is that it first generates a complete list of the first 100 numbers (the inner Table
) command and then filters out even numbers. A better way would be to "streamline" the application of Select
and OddQ
while the list is generated. Haskell works this way, as far as I understood from little reading about it.Tags: Mathematica Haskell
No comments:
Post a Comment