Wolfram Language


The Wolfram Language is a general multi-paradigm computational language developed by Wolfram Research. It emphasizes symbolic computation, functional programming, and rule-based programming and can employ arbitrary structures and data. It is the programming language of the mathematical symbolic computation program Mathematica.

History

The Wolfram Language was a part of the initial version of Mathematica in 1988. Judging by MockMMA's 1991 examples, the M-expression syntax has been there ever since, as are the symbolic, functional, and pattern-matching-by-rewriting facilities. Overall, these make Wolfram a Turing complete language, with support for meta-algorithms and superfunctions.
Symbolic aspects of the engine make it a computer algebra system. The language can perform integration, differentiation, matrix manipulations, and solve differential equations using a set of rules. Also there in 1988 was the notebook model and the ability to embed sound and images, at least according to Theodore Gray's patent.
An online frontend for the language, WolframAlpha, was released in 2009. Wolfram implemented this website by translating natural language statements into Wolfram-language queries that link to its database. This frontend greatly enlarged the audience of the language, and the work leading to Wolfram Alpha also means that Wolfram's implementation of the language now has built-in access to a knowledge-base as well as natural language processing functions. Wolfram also added features for more complex tasks, such as 3D modeling.
A name was finally adopted for the language in 2013, as Wolfram Research decided to make a version of the language engine free for Raspberry Pi users, and they needed to come up with a name for it. It was included in the recommended software bundle that the Raspberry Pi Foundation provides for beginners, which caused some controversy due to the Wolfram language's proprietary nature. Plans to port the Wolfram language to the Intel Edison were announced after the board's introduction at CES 2014. In 2019, a link was added to make Wolfram libraries compatible with the Unity game engine, giving game developers access to the language's high level functions.

Syntax

The Wolfram Language syntax is overall similar to the M-expression of 1960s LISP, with support for infix operators and "function-notation" function calls.

Basics

The Wolfram language writes basic arithmetic expressions using infix operators.

4 + 3
1 + 2 *
3 / 2

Function calls are denoted with square brackets:

Sin
N

Lists are enclosed in curly brackets:

Syntax sugar

The language may deviate from the M-expression paradigm when an alternative, more human-friendly way of showing an expression is available:
A formatter desugars the input:

FullForm

Functional programming

is supported.

Pattern matching

Functions in the Wolfram Language are basically a case of simple patterns for replacement:

F := x ^ 0

The is a "SetDelayed operator", so that the x is not immediately looked for. is syntax sugar for, i.e. a "blank" for any value to replace x in the rest of the evaluation.
An iteration of bubble sort is expressed as:

sortRule := /; y>z ->

The operator is "condition", so that the rule only applies when. The three underscores are an syntax for a, for a sequence that can be null.
A ReplaceRepeated operator can be used to apply this rule repeatedly, until no more change happens:

//. sortRule

The pattern matching system also easily gives rise to rule-based integration and derivation. The following are excerpts from the Rubi package of rules:

Int :=
Log;
Int :=
x^/ /;
FreeQ && NeQ

Implementations

The official, and reference, implementation of the Wolfram Language lies in Mathematica and associated online services. These are closed source. Wolfram Research has, however, released a C++ parser of the language under the open source MIT License. A number of libraries and functions written in this language are open source, and the reference book itself is open access.
In the three-decade-long existence of the Wolfram language, a number of open source third party implementations have also been developed. Richard Fateman's MockMMA from 1991 is of historical note. Modern ones still being maintained as of 2020 include Symja in Java, expreduce in Golang and the SymPy-based Mathics. These implementations focus on the core language and the computer algebra system that it implies, not on the online "knowledgebase" features of Wolfram.

Naming

The language was officially named in June 2013 although, as the backend of the computing system Mathematica, it has been in use in various forms for over 30 years since Mathematica's initial release. Before 2013, it was internally referred to by several names, such as "M" and "Wolfram Language." Other possible names Wolfram Research considered include "Lingua" and "Express."