Re:Statements vs. Expressions
by FeepingCreature on Saturday July 16, 2022 @05:06AM
(#32116348)
I think you're mixing up syntax and semantics. Function calls that return void are usually better classified semantically as procedures, at least when trying to understand how the program is arranged.
I think the general consensus is that expressions evaluate to values in unexceptional situations, full stop. Whether they have side effects is immaterial. Whether the value returned is useful or not is also immaterial. Perhaps your examples weren't the best, since both setf and loop evaluate to values which are often useful.
This isn't just Lisp. For example, the C99 specification explicitly declares that all function calls are expressions, even if they return void.
Wikipedia also defines an expression (vs. statement) unambiguously as "a syntactic entity in a programming language that may be evaluated to determine its value.... Expression is often contrasted with statement—a syntactic entity that has no value (an instruction)."
https://en.wikipedia.org/wiki/Expression_(computer_science)