Differences between version 2 and previous revision of QuickLispTutorial.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Sunday, September 14, 2003 4:57:25 pm | by GlynWebster | Revert |
Older page: | version 1 | Last edited on Sunday, September 14, 2003 4:53:07 pm | by GlynWebster | Revert |
@@ -1,4 +1,7 @@
+!!! The basics of LISP
+
+(If this this interests you look through some of the links off the [LISP] page.)
This is a list:
(apple orange banana)
@@ -38,10 +41,11 @@
__cdr__ returns the rest of the list (ie all-but-first):
(print (cdr mylist))
(b c)
-And that is basically LISP ;)
-The names "car" and "cdr" are because
the first machine that lisp
was written for,
there were 2 registers and the commands "contents of address register" and "contents of decrement register".
+And that is basically [
LISP]
;)
+
+The names "car" and "cdr" came from
the first machine that Lisp
was written for:
there were 2 registers and the commands "contents of address register" and "contents of decrement register". CommonLisp allows the more sensible names "first" and "rest
".
The following example is an inefficient factorial function[1]:
(defun fact (x) ;a recursive function
(if (> x 0)
@@ -50,5 +54,4 @@
) )
----
[1] this stupid function has become the HelloWorld of functional ProgrammingLanguages, for some reason.
--specific