# LISP, What Does Symbolic Language Mean?

By Xah Lee. Date: . Last updated: .

### Summary

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)

### Lisp, What's the Significance of a Language Being “Symbolic”?

lisp and Wolfram Language 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 Wolfram Language 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 Wolfram Language 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.

E.g. In python, x = 3, then x is just 3. But in lisp, x and 3 are different thing. 3 is value. You can get the unevaluated form of x (just a “symbol”) 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 detail 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.

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.

as far as i know , the lisp/Mathematica approach of “symbolic”, isn't embraced to be uber in comp lang design 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”.

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.

### Computer Algebra

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.

[https://en.wikipedia.org/wiki/Computer_algebra]

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

another thing i found about symbolic lang is that it seems to solve the problem of string-hell in Javascript+DOM. You have lots strings such as .`style="color:red"`, very inflexible and error prone. Currently still unsure what's the root cause of this string hell problem.

Examples of string problem in JavaScript+DOM:

```const f_scale_str = ((x, y) =>
/* [
return string of the form " scale(x y) " for use with svg transform attribute. ] */
(` scale( \${x} \${y} ) `));```
`const svgg = document.createElementNS("http://www.w3.org/2000/svg", "svg");`
```svgg.setAttribute("width", width.toString());
svgg.setAttribute("style", styleStr);
```
`path_2wk2r.setAttribute("d", "M " + sX + " " + sY + " A " + [rx, ry, φ / (2 * π) * 360, fA, fS, eX, eY].join(" "));`
`let directionX = document.querySelector('input[name="direction10757"]:checked').value;`
`document.querySelector ( '#submit_c89n7' ) .addEventListener ('click', f_update, false);`

### 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?

If you have a question, put \$5 at patreon and message me.