Guard (computer Science) - Evolution

Evolution

A simple conditional expression, already present in CPL in 1963, has a guard on first sub-expression, and another sub-expression to use in case the first one cannot be used. Some common ways to write this:

(x>0) -> 1/x; 0 x>0 ? 1/x : 0

If the second sub-expression can be a further simple conditional expression, we can give more alternatives to try before the last fall-through:

(x>0) -> 1/x; (x<0) -> -1/x; 0

Already ISWIM in 1966 had a form of conditional expression without an obligatory fall-through case, thus separating guard from the concept of choosing either-or. In the case of ISWIM, if none of the alternatives could be used, the value was to be undefined, which was defined to never compute into a value.

SASL (1976) was one of the first programming languages to use the term "guard". In the language, functions could have several definitions and the one to apply was chosen based on the guards that followed each definition:

fac n = 1, n = 0 = n * fac (n-1), n > 0

Read more about this topic:  Guard (computer Science)

Famous quotes containing the word evolution:

    Like Freud, Jung believes that the human mind contains archaic remnants, residues of the long history and evolution of mankind. In the unconscious, primordial “universally human images” lie dormant. Those primordial images are the most ancient, universal and “deep” thoughts of mankind. Since they embody feelings as much as thought, they are properly “thought feelings.” Where Freud postulates a mass psyche, Jung postulates a collective psyche.
    Patrick Mullahy (b. 1912)

    The evolution of sense is, in a sense, the evolution of nonsense.
    Vladimir Nabokov (1899–1977)

    Analyze theory-building how we will, we all must start in the middle. Our conceptual firsts are middle-sized, middle-distanced objects, and our introduction to them and to everything comes midway in the cultural evolution of the race.
    Willard Van Orman Quine (b. 1908)