Kernel (programming language)

From Wikipedia, the free encyclopedia

Kernel is a Scheme-like programming language by John N. Shutt in which all objects are first-class.

[edit] Example

In Scheme and is a macro, because for example (and #f (/ 1 0)) must not evaluate the division. This also means it cannot be used in higher-order functions; it is second-class. In Kernel one has $and? defined by

($define! $and?
   ($vau x e
      ($cond ((null? x)         #t)
             ((null? (cdr x))   (eval (car x) e))
             ((eval (car x) e)  (apply (wrap $and?) (cdr x) e))
             (#t                #f))))

which is a first-class object — technically, a fexpr — and can thus be used in higher-order functions, such as map.

[edit] References