Wolfram Computation Meets Knowledge

The Wolfram Language:
Fast Introduction for Programmers

Show additional notes for:
All sections 
Get Started

Symbolic Expressions

Everything in the Wolfram Language is a symbolic expression.

Notes for Java programmers:

Symbolic expressions provide an extremely general way of representing data in a uniform, tree-like structure. They add a high level of flexibility in programming, allowing manipulation of both structure and content. Java does not have symbolic capabilities, although basic features may be available using third-party libraries.

Notes for Python programmers:

The Wolfram Language's symbolic expressions provide an extremely general way of representing data within a uniform tree-like structure. They add a high level of flexibility in programming, allowing manipulation of both structure and content. Python does not have built-in symbolic capabilities.

All symbolic expressions have the same fundamental structure: head[arguments]

Notes for Java programmers:

An expression's head identifies the type of data or operation being represented. Unlike in Java, which is statically typed, a Wolfram Language expression's head may transform during evaluation.

Notes for Python programmers:

A Wolfram Language expression's head identifies the kind of data or operation being represented and may be transformed at any time during evaluation. Every Python object has a declared class that cannot be changed.


The argument to a function can be any symbolic expression:

In[1]:=1
EdgeDetect[\!\(\* Graphics3DBox[SphereBox[{0, 0, 0}], ImageSize->{101.28125, Automatic}, ViewPoint->{1.3380550962130968`, -2.4157167423337023`, 1.9554848964660412`}, ViewVertical->{0.010787606954750626`, -0.012563066244060768`, 0.9998628890516625}]\)]
Out[1]=1

The Wolfram Language is fully symbolic, so "undefined variables" can always just stand for themselves:

In[1]:=1
x
Out[1]=1

Notes for Java programmers:

Uninitialized Java objects and primitives generally take on default values of null, 0 or false, and attempting to use such variables can cause NullPointerException or other errors to be thrown.

Notes for Python programmers:

The Wolfram Language's symbolic expressions enable programmers to seamlessly use undefined variables as symbols in their computations. Unassigned variables in Python are considered "undefined," and attempting to use an undefined variable causes a NameError.


FullForm always shows the underlying structure.
Head always gives the head of an expression; Length gives the number of arguments.


© 2018 Wolfram. All rights reserved.