LISP, What Does Symbolic Language Mean?
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
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.
[see What's 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.
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”.
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]
(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
, you have
now you have parsing string problem.
Here's Wikipedia explanation on Computer algebra (2019-07-24):
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.
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?