F# vs Mathematica: Pythagoras tree
The F# News blog recently published an article about the Pythagoras tree that included the complete F# source code for a program that renders the tree. Interestingly, the Wolfram Demonstrations Project contains a similar implementation written in the Mathematica language, which is a domain-specific language designed for interactive technical computing.
Surprisingly, the implementation written in the general purpose F# programming language is not only much faster but is also substantially shorter and clearer. Here is the F# code:
And here is the substantially more complicated Mathematica code:
This example really highlights just how versatile the F# programming language has become without sacrificing the benefits of more conventional languages.
Comments
Post a Comment