This page is mostly focused on:
- Wolfram Language (WL) — kernel of Wolfram Mathematica
- Wolfram Mathematica (WM) = WL + FrontEnd
Do not confuse WL/WM with other things such as:
- Wolfram Alpha — web «answer engine»
- Wolfram Cloud — web version of WM (with much weaker FrontEnd)
- Wolfram Engine (WE) — WL distributed as a software
- Wolfram Desktop — WM distributed as a software
- Wolfram Research Insitute (WRI) — company behind all those products
What is WM/WL as programming language
WL/WM is (by definition inspired by Leonid Shifrin):
- Functional programming language …
- … built on top of rule-based engine …
- … with rich pattern-matching and evaluator …
- … with both operating on general symbolic trees.
Alternatively WL/WM is also often seen as term-rewriting system.
Among other things, WL/WM is CAS (computer algebra system) with a possibility to create your own math notations.
As a programming language, WL also has:
- Lazy evaluation
- Everything is expression principle
- WL is untyped, «even more» than most other languages
- So-called two-way data binding approach for creating GUI and Interactivity, which is subset of Reactive programming (or Functional Reactive programming)
WL directly supports paradigms:
- Functional
- Procedural
- Reactive (mostly for GUI)
- It also supports other paradigms, which I don’t have experience to talk about
Also, OOP is not as streightforward in WL, but still can be implemented.
WL in its early days took its inspirations mainly from:
- LISP (FullForm resembles LISP s-expressions, Hold/Release resembles LISP macros)
- APL (Map/MapAll/Partition/… resembles APL array-operations)
WM/WL: Pros and Cons
Pros:
- Deeply integrated math/science into language
- All parts of language are unified into one coherent system:
Example
What I mean by «unified coherent system» is best shown on example.
To build some «interactive math app with plots» in Python you will need to use at least 4 separate things:
- Python itself
- possibly math/numpy module
- plotting module (like matplotlib)
- gui-lib like PyQt/Tkinter/DPG
And then it will be your responsibility to unify all of them into one system.
Compare it with WM, which has all those 4 things already unified in one system.
- FP (functional-paradigm) and APL (array-based) features deeply intagrated into language
- Immediate interactivity and GUI-building
- Creating of very high abstractions is easy in WL, upto creating DSL just with WL
- Offline interactive documentation like no other language has
Cons:
- No reasonable deploy/share (CDF requires installation, Cloud is slow)
- Payed and not open-source (the latter however is not universally seen as a drawback)
- Relatively small community
- Weights currently 15Gb+ and constantly growing from version to version (however, WE weights 1Gb, which is more reasonable)
It is worth mentioning that one of the main flaws attributed to WM is it is slow.
However, advanced WM users do not agree with it.
The problem comes from WM rich sytax and support of many programming paradigms
(there is talk by Leonid Shifrin where he shows that Fibonacci function can
be created in around 20 vastly different ways). Difference between usage of various paradigms in WM can result in
million-time (yes) code speed up. It mostly comes from utilizing
APL and FP constructs, which are not some high-level woodoo tricks, but
rather intermediate WM features.
Details: is WM really slow?
How do I actually use WM
I work as a stress engineer, and use programming as a support tool mostly for various secondary Data Science tasks (like processing output of CAE software).
To me WM in short is thinking laboratory for rapid prototyping (again, this definition comes from Leonid Shifrin).
As a hobby, I mostly use WM:
- for creating small interactive apps that help me understand topic that I am currently learning (which are mostly STEM-related)
- for creating quick visualizations needed to reason about same topics
As a tool in payed work, I use WM:
- when my goal is to only produce and show results from analizing data/problem (and nobody actually cares how did I obtain these results in the first place)
- for creating my own scripts that nobody uses besides me (like quick plotting, reading txt files, etc.)
I never had a colleague who used WM lol, so I have to avoid WM in a team-work.
Thus, whenever I need to share (eather code or standalone app), I am using other tools (Python, Excel, etc.).