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.
An atom is one of: Number, Symbol, String , Special Character. [see Atomic Expression]
Expression

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

e0[e1, e2 etc]

Each of the e is a expression.

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

Many commonly used functions has syntax shortcuts. For example, you can write

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 e0[] is called FullForm.
  • Atomic Expression such as 3, x, "abc", are in FullForm by themselves.
  • The WolframEngine convert shortcut syntax to FullForm internally before eval.
  • All Pattern Matching are done against FullForm.

You can use FullForm[Hold[expr]] to show the FullForm. [see WolframLang Syntax/Operators]

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