>   (define (map f l)
>     (if (pair? l)
>         (cons (f (car l))
>               (map f (cdr l)))
>         '()))
>
> whereas we used to have to write code like this in order to support long
> lists without overflowing the stack:
>
>   (define (map f l)
>     (let loop ((l l) (out '()))
>       (if (pair? l)
>           (loop (cdr l) (cons (f (car l)) out))
>           (reverse out))))

Ignoring stack usage, is the first version faster or slower than the second?
[ Or is the speed difference negligible?  ]

How 'bout using a side-effecting `reverse!` (like Lisp's nreverse)?


        Stefan


Reply via email to