My favorites | Sign in
Project Logo
                
Search
for
Updated May 18, 2007 by cdiggins
Labels: Glossary
Purity  
Explanation of purity and impurity.

Purity

A pure expression is an expression that has no side-effects. An expression is pure if and only if all sub-expressions are pure. Quotations and literals are always pure. A quotation may be impure if evaluated.

A pure function is a function which consists of only pure expressions.

A pure expression is referentially transparent.

Pure functions have a type expressed as: (Consumption -> Production) where as impure functions have a type expressed as (Consumption ~> Production).

A language is pure if only pure expressions can be expressed using it. The subset of Cat consisting of only Level0 and Level1 primitives is pure.


Sign in to add a comment
Hosted by Google Code