Mathematica as a Programming Language
Mathematica is an unprecedentedly flexible and intuitive programming language.
Mathematica includes advanced programming methods from modern computer science--as well as adding 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.
Many operations are automatically threaded over lists.
This flattens out sublists.
This partitions into sublists of length 2.
The is a "pure function". The argument is inserted into the # slot.
The _ stands for a single expression; __ stands for any sequence of expressions.
Here are three definitions to be associated with the object h.
This uses the definitions made for h.
Mixed programming paradigms
Many of Mathematica's most powerful functions mix different programming paradigms.
A dozen definitions of the factorial function.
Mathematica gives you the flexibility to write programs in many different styles.
After you have finished with definitions for f, you must clear them.