Kernel (programming language)
Encyclopedia
Kernel is a Scheme-like programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 by John N. Shutt in which all objects are first-class
First-class object
In programming language design, a first-class citizen , in the context of a particular programming language, is an entity that can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable...

.

Example

In the programming language Scheme, and is a macro, because (and #f (/ 1 0)) must not evaluate the division. This 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
Fexpr
In Lisp programming languages, a fexpr is a function whose operands are passed to it without being evaluated. When a fexpr is called, only the body of the fexpr is evaluated; no other evaluations take place except when explicitly initiated by the fexpr...

— and can thus be used in higher-order functions, such as map.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK