LISP, What Does Symbolic Language Mean?

By Xah Lee. Date: . Last updated: .


the power of programing language that are symbolic such as lisp and Mathematica, seems to be that they allow symbolic pattern matching, and in turn seems to be required feature for doing computer algebra. (e.g. expand/simply polynomials)

What is the Significance of a Language Being Symbolic

(article originally written on twitter, each sentence is limited to 140 chars.)

lisp and WolframLang are said to be symbolic languages. But, what does it mean? what's the significance? what's its nature?

Stephen Wolfram has particularly claimed, that blab blab what a genius he designed WolframLang because from the outset he made it SYMBOLIC.

But, what's the significance of lang being SYMBOLIC? is it more powerful? how? what exactly makes a lang symbolic?

i've coded emacs lisp for 10+ years, and WolframLang for 10+ years. Both are symbolic languages of the lisp family.

they are SYMBOLIC, in the sense that they deal with symbols. In short, all identifiers can be their values, or just their “names” itself.

for example in python, after x = 3, x is always 3. In lisp, symbol and its value remain separate. You can get the unevaluated form of x by 'x

more explanation about lisp symbol here Emacs Lisp Symbol (tutorial)

But off the bat from experience, i'd say lang that's SYMBOLIC has little to do with lang's power. But i want a logic based answer that details why.

to consider meaning of SYMBOLIC, we need to consider lang design elements. what things, if possible, constitute element of lang design?

first, comp lang is a instruction set. That's its nature.

first of all, to talk about computer lang, you need to have a machine in mind. Because no machine, no instruction.

machine here is, eg 10 stones on floor, abacus, turing machine, intel icoreX cpu, Java Virtual Machine.

so, when considering computer lang design, we want to find elements of lang, there does not seem to have a well defined set of such.

that is, symbolic lang, closure, object, lambda, subroutine, if, for, pointer, strong types, rewrite lang, array lang, brainfuck… there actually is no clearly defined things.

rephrase: there is no clearly defined elements that we can say, that computer lang comprise of. Rather, it's free form, free roam, open design.

[see What is Ontology of Programing Language?]

but basic concept seems exist: variable, subroutine, branch control, loop, value, types (number, string, array). These are basic in the sense of minimum abstraction for high-level languages.

recap: we want to find the nature of symbolic lang. We looked for elements of computer lang. No such. So, lisp symbolic is just 1 of myriad pecularity.

now failing some kinda logical foundation search, we turn into experience, or survey approach.

Symbolic nature in lisp/WolframLang isn't considered to be superior or necessary a feature outside of lisp circle.

but still i think lisp SYMBOLIC nature can be captured in some sense as kinda layer. A certain uniform treatment of something…

certain generalized treatment of identifiers.

from Brandon Bloom ‏@BrandonBloom 2016 Aug 31

@xah_lee I think mostly it is a shorthand and anachronism for “term rewriting language”.

that made a lot sense!

i think that's it. The effect of a language being SYMBOLIC is just that it allows term rewriting. (the limited form of term-rewrite feature is lisp macros. The full feature is Mathematica's pattern matching.)

then, if we keep asking, what does term rewiring give us? what power? The answer is, not much. Term rewiring is just one model of computation. Term rewriting language is particularly good for doing computer algebra (example: manipulate formulas such as expand polynomial, solve equations, derivative, etc.), possibly almost a required feature, otherwise may be much harder to implement.

Symbolic Language and Computer Algebra

Problem, expand or factor this polynomial:

(a x^2 + b y^2 )^2


a^2 x^4 + b (2 a x^2 y^2 + b y^4)

Problem: expand this matrix vector multiplication (symbolically).

[ [a,b], [c,d] ] . [x,y]

Solution: (a x + b y, c x + d y)

This type of problems are called computer algebra. They include solving equations, derivative, integral.

Symbolic languages seems to be essential requirement for implementing these problems.

For example, suppose you want to call a matrix vector multiplication function, example:

matrixTimesVector([ [a,b], [c,d] ] , [x,y] )

In typical languages, the first problem is how do you represent those arguments. Most languages will complain than a b c d x y are not defined.

If you think “lets use strings”, you have:

matrixTimesVector([ ["a","b"], ["c","d"] ] , ["x","y"] )

This is cumbersome to type. But also, when elements are more complex, say x is now x^2+1 , you have "x^2+1", now you have parsing string problem.

Here's Wikipedia explanation on Computer algebra (2019-07-24). Note how it says it's called symbolic computation.

In computational mathematics, computer algebra, also called symbolic computation or algebraic computation, is a scientific area that refers to the study and development of algorithms and software for manipulating mathematical expressions and other mathematical objects. Although computer algebra could be considered a subfield of scientific computing, they are generally considered as distinct fields because scientific computing is usually based on numerical computation with approximate floating point numbers, while symbolic computation emphasizes exact computation with expressions containing variables that have no given value and are manipulated as symbols.

Software applications that perform symbolic calculations are called computer algebra systems, with the term system alluding to the complexity of the main applications that include, at least, a method to represent mathematical data in a computer, a user programming language (usually different from the language used for the implementation), a dedicated memory manager, a user interface for the input/output of mathematical expressions, a large set of routines to perform usual operations, like simplification of expressions, differentiation using chain rule, polynomial factorization, indefinite integration, etc.

Computer algebra is widely used to experiment in mathematics and to design the formulas that are used in numerical programs. It is also used for complete scientific computations, when purely numerical methods fail, as in public key cryptography, or for some non-linear problems.

JavaScript+DOM String-Hell Problem is a Symptom of Language Not Symbolic?

JavaScript/DOM String Hell and Symbolic Languages

Relation of (non-deterministic) Rule Based Programing Language and (deterministic) Static Typing. Or, Can Haskell be Symbolic and Remain Much Haskell?

also, if you have symbolic language , you likely have rule based programing system like Mathematica. Now, how's that mesh with static typing? Is it possible to have both, or must be one or the other? Put in another way, can haskell be symbolic and remain much haskell?

Xah Talk Show

Xah Talk 2019-07-18 lisp, Mathematica, term rewriting, pattern matching, idiocy of lisp macros