Shorter words for “expression”







  1. I think a Lisp form is more general than an expression; it's an expression giving rise to a value from the point of view of the Lisp parser, but not necessarily from the point of view of the programmer thinking at the semantic level.

    Conversely, I'd object somewhat to using 'term' as a synonym for expression. A factor is a piece of an expression split up at the multiplication level, while a term is a piece split up at the additive level. In "a*x + b", {a, x, b} are factors. The terms, meanwhile, are {"a*x", "b"}. But "a*x + b" is an expression.

    See e.g. etc. for more details.

  2. In Common Lisp, at least, "form" pretty consistently means something to evaluate; a value that's read but not evaluated would usually be called a "sexpr" or "object". (The HyperSpec agrees with common usage.)

    The static-typing sense of "term" is probably derived from the standard math sense, but the meaning is different; in that community, it really does mean any expression, not just one that might be an argument of +. Despite that community's love of math, I don't think the redefinition causes much confusion, probably because the standard sense is a convenience rather than a name for an important concept. (Although these and other names-for-arguments like "numerator" and "exponent" are a whole class of terminological conveniences that hardly exist in programming languages, and maybe should.)

    (The previous comment didn't appear because it was stuck in the spam filter, which has so far not caught any actual spam.)


It's OK to comment on old posts.