How some basic LISP-functions are defined.
May 27th, 2008 at 2:00am |
Today, Pål gave me a link to this lisp-file, which shows how some basic LISP-functions are defined. For those used to “first” and “rest”, those are called “car” and “cdr”, guess that was “the shit” in the 60’s. It’s kinda interesting seeing how functions you take for granted like “and”, actually is defined by other lisp functions. Here’s the code for “and”, for those who’s interested:
(defun and. (x y)
(cond (x (cond (y 't) ('t '())))
('t '())))
As you can see, it’s pretty much made out of the function cond. Great!
Posted in LISP