[plt-scheme] Re: HTDP: So you thought us empty? and empty

From: Bill Wood (bill.wood at acm.org)
Date: Sun Dec 7 02:54:12 EST 2003

FWIW, I tried this in CLISP 2.3 under Mandrake Linux 9.1.  The code:

    (defun my-make-list (n)
      (labels ((mml (k acc)
                      (cond ((< k 1) acc)
                                (t (mml (- k 1) (cons nil acc))))))
        (mml n '())))

Running interpreted (just load and invoke):

    [8]> (length (my-make-list 200))
    200
    [9]> (length (my-make-list 2000))
    2000
    [10]> (length (my-make-list 20000))
 
    *** - Lisp stack overflow. RESET
 
After compiling:

    [29]>  (length (my-make-list 200))
    200
    [30]> (length (my-make-list 2000))
    2000
    [31]> (length (my-make-list 20000))
    20000
    [32]>  (length (my-make-list 2000000))
    2000000
    [33]>  (length (my-make-list 20000000))
    3222784

I haven't chased down the reason for the last result, but there's some 
evidence that CLISP at least does tco when compiling.

 -- Bill Wood
    bill.wood at acm.org



Posted on the users mailing list.