Question

In: Computer Science

What makes functional values possible in Haskell?

What makes functional values possible in Haskell?

Solutions

Expert Solution

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.


Related Solutions

Compare the measured values of tension to the calculated values of tension. What are the possible...
Compare the measured values of tension to the calculated values of tension. What are the possible physical experiment uncertainties for the differences between the measured and calculated? Measured= .075N Caculated= .079N Velocity v = .433m/s Mass of Cylinder m = .1118kg Radius of Pendulum r = .265 T=mv2/r
Suppose the possible values of X are {xi}, the possible values of Y are {yj}, and...
Suppose the possible values of X are {xi}, the possible values of Y are {yj}, and the possible values of X + Y are {zk}. Let Ak denote the set of all pairs of indices (i,j) such that xi+yj =zk;thatisAk ={(i,j):xi+yj =zk} a. Argue that b. Argue that P{X+Y=zk}= ? P{X=xi,Y=yj} (i,j )∈Ak E[X+Y]=? ? (xi+yj)P{X=xi,Y =yj} k (i,j )∈Ak c. Using the formula in b, argue that E[X+Y]=??(xi+yj)P{X=xi,Y =yj} ij d. Show that P(X =xi)=?P(X =xi,Y =yj),P(Y =yj)=?P(X =xi,Y...
Write the functional form of a demand curve that has the property of independence. What makes...
Write the functional form of a demand curve that has the property of independence. What makes a demand curve independent? Do the demand curves for functions that describe perfect substitutes and perfect complements have the property of independence, explain?
If the n quantum number of an atomic orbital is 4, What are the possible values...
If the n quantum number of an atomic orbital is 4, What are the possible values of l? What are the possible values of ml?
Identify the possible values of each of the 3 variables in this dataset and describe what...
Identify the possible values of each of the 3 variables in this dataset and describe what information each of the 3 variables tells us about the data Heart rate before and after exercise M=0 F=1 Resting After Exercise 0 85.9 87.5 0 67.7 79.4 0 80.3 93.4 0 85.2 97.7 0 86.3 99.7 0 76.6 83.7
13. What is retrograde signaling? What is it about endocannabinoids that makes retrograde signaling possible? What...
13. What is retrograde signaling? What is it about endocannabinoids that makes retrograde signaling possible? What aspect of the general way the endocannabinoids seem to work seems unexpected given that these are lipid soluble molecules?
5. What is the full numerical range of possible Rf values in a TLC experiment? (not...
5. What is the full numerical range of possible Rf values in a TLC experiment? (not the range that might be desired or useful for some analytical purpose, but the absolute limits) 6. Consider the structure of ferrocene (you may wish to refer to the "Ferrocene 3D Models" item on our Blackboard site). a. Focusing solely on the hydrocarbon parts (bonds within one ring or the other, completely ignoring the iron atom and all bonds to it), what is the...
state the four quantum numbers then explain the possible values they may have and what they...
state the four quantum numbers then explain the possible values they may have and what they actually represent
what is functional group? what can be functional group in organic compound?
what is functional group? what can be functional group in organic compound?
Given the following table of possible values for rv Z and the number of possible ways...
Given the following table of possible values for rv Z and the number of possible ways that this value can occur, Construct the pmf and cdf for this rv Graph the cdf Calculate Pr(Z=6) Calculate Pr(Z=2) Calculate Pr(Z > 4 or Z ≤ 2) Calculate Pr( 1 < Z ≤ 6) Calculate Pr( Z ≤ 3 | Z < 9 ) Z Count 0 4 1 10 2 16 4 11 6 5 8 3 9 1
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT