In: Computer Science
What makes functional values possible in Haskell?
1 + 3 * 3
concat("hello," "world)
"let x= pow(2, 2)
lambda x. x
Please note that lambda x. (the identity function) is a language expression. In any context where an expression is anticipated, it can be used interchangeably; for instance, we can write 1 + lambdax instead of 1+ 1. x*. In specific, as the arguments for a function are expressions and functions are expressions themselves, we can pass features on to features as statements, such as maps(lambdax. x, [1, 2, 3]).
Values
Expressions are static. it's
the work of the dynamics of a language to
inform us how
expressions are to be evaluated
throughout run-time. The (operational) dynamics
consists of a group of
straightforward transition rules for
transforming one type of
expression into another. for instance, our
dynamics could have a rule that, informally, says
"n1 + 0 transitions to n1".
The values in a language are a
set of expressions that we tend
to concede to be we
evaluated; we write programs (expressions) to
compute values. The expressions are given
on top of evaluating to:
7
"hello world"
256
lambda x. x
Tangent: It ought to be the case that a
value cannot transition to a different
expression, however, the converse
doesn't generally hold; there
are some expressions (e.g. seven
+ "hello world") that can't be evaluated
further, yet
aren't values. the aim of
a type system is to avoid such
things.
Thus, to declare that "functions are values"
we should do a priori insist that
functions be expressions. In our language, we do
contemplate functions to be valued;
therefore, lambda x. x may be a
value, and map(lambda x. x, [1 2
3]) may be a valid expression.
As so much as I do know,
it might be useless to create a
language in which functions are
expressions however not values.