This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Wolfram Research, Inc.

The Unifying Idea of MathematicaWriting Programs in Mathematica

Mathematica as a Programming Language

Mathematica is an unprecedentedly flexible and intuitive programming language.

Mathematica includes advanced programming methods from modern computer science —and adds a host of new ideas of its own.

Mathematica incorporates a range of programming paradigms—so you can write every program in its most natural way.

Procedural Programming

List-based Programming

Many operations are automatically threaded over lists.

This flattens out sublists.

This partitions into sublists of length 2.

Functional Programming

The is a "pure function". The argument is inserted into the # slot.

Rule-Based Programming

The _ stands for a single expression; __ stands for any sequence of expressions.

Object-Oriented Programming

Here are three definitions to be associated with the object h.

This uses the definitions made for h.

String-Based Programming

Mixed Programming Paradigms

Many of Mathematica's most powerful functions mix different programming paradigms.

Mathematica gives you the flexibility to write programs in many different styles.

Here are a dozen definitions of the factorial function.

After you have finished with definitions for f, you must clear them.

The Unifying Idea of MathematicaWriting Programs in Mathematica