Principles of Wolfram Language
Principle of Wolfram Language Syntax
- Everything is a Expression.
- Expression is either an atom, or a list of atoms in the form
a[b, c etc]
, arbitrarily nested. - Atom is a number e.g.
3.4
, a Symbolx
, string"cat"
, or special character e.g.\[Pi]
. - There are many short syntax for function or function call. For example:
List[1,2,3]
can be written as{1,2,3}
, andSet[x,2]
can be written asx=2
, andPlus[1,2]
can be written as1+2
. WolframEngine transform any short syntax to the fully nested forma[b, c etc]
internally before computation. [see WolframLang Syntax/Operators]
- WolframLang code is just a sequence of expressions, practically just function calls. Knowing what function to call is the essence of coding WolframLang. [see WolframLang: List Functions, Find Function]
How Does Wolfram Language Do Computation
There are 2 ways WolframLang does computation.
- Function call. Either builtin or user defined. For example,
Plus[3, 2]
,Sin[3]
,Range[5]
,If[3 > 2, "yes", "no"]
- Syntactical transformation by pattern matching and replacement. (aka term rewriting system)