4.3 Lazy evaluation

Prev Up Next Page 29 of 800 Search internet

At the most fundamental level, Logiweb is a lazy functional programming language. More specifically, the language is lambda calculus (lambda abstraction \ x . A, functional application x ' y, and variables) extended with a constant true, a selection construct If x then y else z, and quoting quote t end quote.

The constant true is similar to NIL in Lisp and null in C. When used for representing a list, true represents the empty list just like NIL and null do. When used for representing a Boolean, true represents truth opposite to what NIL and null do.

The If x then y else z construct equals y if x equals true and equals z if x differs from true (except if computation of x loops indefinitely, of course). A term x is considered to differ from true iff x can be reduced to a term of form \ x . A.

The value of quote t end quote represents the term t. In principle, quote t end quote could be macro expanded into a monster formula containing only lambda abstraction, truth, and If-then-else.

Prev Up Next Page 29 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05