Eval - Theory

Theory

In theoretical computer science, a careful distinction is commonly made between eval and apply. Eval is understood to be the step of converting a quoted string into a callable function and its arguments, whereas apply is the actual call of the function with a given set of arguments. The distinction is particularly noticeable in functional languages, and languages based on lambda calculus, such as LISP and Scheme. Thus, for example, in Scheme, the distinction is between

(eval '(f x) )

where the form (f x) is to be evaluated, and

(apply f (list x))

where the function f is to be called with argument x.

Eval and apply are the two interdependent components of the eval-apply cycle, which is the essence of evaluating Lisp, described in SICP.

In category theory, the eval morphism is used to define the closed monoidal category. Thus, for example, the category of sets, with functions taken as morphisms, and the cartesian product taken as the product, forms a Cartesian closed category. Here, eval (or, properly speaking, apply) together with its right adjoint, currying, form the simply typed lambda calculus, which can be interpreted to be the morphisms of Caretesian closed categories.

Read more about this topic:  Eval

Famous quotes containing the word theory:

    The theory [before the twentieth century] ... was that all the jobs in the world belonged by right to men, and that only men were by nature entitled to wages. If a woman earned money, outside domestic service, it was because some misfortune had deprived her of masculine protection.
    Rheta Childe Dorr (1866–1948)

    The theory of the Communists may be summed up in the single sentence: Abolition of private property.
    Karl Marx (1818–1883)

    Lucretius
    Sings his great theory of natural origins and of wise conduct; Plato
    smiling carves dreams, bright cells
    Of incorruptible wax to hive the Greek honey.
    Robinson Jeffers (1887–1962)