WolframLang: Expression

By Xah Lee. Date: . Last updated: .

WolframLang source code is made of expressions. Every part in source code, is expression. (there is no such thing as “statements”.) Everything is a expression.

Atom
An atom is a indivisible expression, such as number, Symbol, String. [see Atomic Expression]
Expression

Expression is either a single Atom , or a sequence of atoms in the form

f[a, b etc]

any of the f, a, b, etc, is again an expression.

this syntax is called FullForm

Head of expression
The f in f[] is called the Head of expression. [see Head of Expression]
List
A list is a expression whose head is List. [see List]
FullForm

Frequently used functions have syntax shortcuts. Example:

FullFormShortcut
Plus[3,4]3+4
Rational[3,4]3/4
List[3,4]{3,4}
Equal[x,y]x == y
SameQ[x,y]x === y
Greater[x,y]x > y
Set[x,3]x = 3
  • The form f[] is called FullForm.
  • Atomic Expression such as number and string, are in FullForm by themself.
  • The WolframEngine convert shortcut syntax to FullForm internally before eval.
  • All Pattern Matching are done against FullForm.

[see WolframLang: FullForm Syntax]

Expression, Atom, Head

WolframLang in Depth

Basics

Comment, Print

String

Arithmetic

List

Expression, Atom, Head

Boolean

Conditional

Variable

Loop

Data Structure

Function

Pattern Matching

Advanced

Shell Tasks

Misc