Pascal Bourguignon <pjb@informatimago.com> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) writes:
| > But with Common Lisp, it's so *huge* that ... no-one in his/her
| > right mind would *ever* think of trying to write a full CL from
| > scratch by themselves!!
|
| I'm still thinking doing that... When I'm far from my computer, I
| even write pieces of a CL implementation in LispMe on my PDA, to tell
| you how hopeless I am.
+---------------
(*blush*) Me, too. It's a terribly bad habit that's hard to give up.
About a year and a half ago I made a stab at a "Quick & Dirty Lisp",
just to see if I could code up a usable CL subset[1] suitable for
"scripting"[2], and I sort of managed, at least for a *very* tiny
subset:
qdl> (oblist)
(FLOAD >= <= > < /= = / * - + 1- 1+ ASSOC LENGTH LIST CONS CDR CAR
MLO D32 DEBUG OBLIST EVAL APPLY FUNCALL VECTOR TERPRI PRINC PRINT
LET* LET DEFUN SETQ IF PROGN LAMBDA QUOTE TEST123 T NIL)
qdl> (defun foo (a b)
(* a (+ b 3)))
FOO
qdl> (foo 12 34)
444
qdl> (apply 'foo (cdr (list 98 12 34)))
444
qdl> (let ((v (vector 1 2 (+ 1 2) (- 5 2) (/ 30 6))))
(list (length v) v))
(5 #(1 2 3 4 5))
qdl> (assoc 'bar '((foo . 123) (bar . 456) (baz . 789)))
(BAR . 456)
qdl> (let* ((v1 32)
(v2 (/ v1 4))
(f (lambda (x) (+ v2 (* x 3)))))
(funcall f 5))
23
qdl> (let ((n 0))
(defun counter1 ()
(setq n (1+ n))))
COUNTER1
qdl> (let ((n 0))
(defun counter2 ()
(setq n (1+ n))))
COUNTER2
qdl> (counter1)
1
qdl> (counter1)
2
qdl> (counter1)
3
qdl> (counter2)
1
qdl> (counter2)
2
qdl> (counter1)
4
qdl> (counter1)
5
qdl> (counter2)
3
qdl>
Fortunately, I didn't waste *too* much time on it. ;-}
[Never *did* write a GC, actually.]
And then I went back to coding in CMUCL...
-Rob
[1] Within the strict definition of a CL subset given by the standard:
http://www.lisp.org/HyperSpec/Body/sec_1-7.html
[Though of course that OBLIST function is not standard.
It and DEBUG were just in there for... well, debugging.]
[2] Even though tests showed that CMUCL was plenty fast for all of
my "scripting" needs -- slightly faster than CLISP, actually.
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607