wiki:FirstPrinciples/EverythingIsAnExpression

Everything Is An Expression

Every expression ultimately denotes (could be reduced to) a value, which has (belongs to) some type (and is type-tagged accordingly).

Values has its types, not "variables". There is no notion of a box-like variables, only of bindings - associations between symbols and values or slots (parts of a structured value). 3 is a symbol which denotes a value of 1+1+1.

This means that every expression has its type (of the value it eventually reduces into), and this implies that all the branches of a conditional expressions (case in ML, cond in Lisp) which technically are sub-expressions to be evaluated depending on the value of a the test, must be of the same type. In other words conditions are homogenous - all its branches (sub-expressions) must be of the same type.

Because everything (without an exception) is an expression, expressions could be nested arbitrarily and then uniformly reduced (according to the given order of evaluation) to a single self-evaluated (or primitive) value, provided that the types of values produced by evaluating (by applying reduction rules based on the principle of substitution of equal for equal) of sub-expressions are consistent (no contradictions detected).

Last modified 17 months ago Last modified on Oct 5, 2018, 3:15:32 PM
Note: See TracWiki for help on using the wiki.