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 whole theory of modern education is radically unsound. Fortunately in England, at any rate, education produces no effect whatsoever. If it did, it would prove a serious danger to the upper classes, and probably lead to acts of violence in Grosvenor Square.
    Oscar Wilde (1854–1900)

    Osteopath—One who argues that all human ills are caused by the pressure of hard bone upon soft tissue. The proof of his theory is to be found in the heads of those who believe it.
    —H.L. (Henry Lewis)

    Every theory is a self-fulfilling prophecy that orders experience into the framework it provides.
    Ruth Hubbard (b. 1924)