[plt-scheme] match.ss performance

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Tue Feb 11 19:24:19 EST 2003

Robert Bruce Findler wrote:
>   (let ([fail (lambda () (match:error ...))])
>     (let ([x l])
>       (if (pair? x)
>           (let ([x2 (cdr x)])
>             (if (pair? x2)
>                 (let ([x3 (cdr x2)])
>                   (if (pair? x3)
>                       (let ([x4 (cdr x3)])
>                         (if (pair? x4)
>                             (let ([x4 (cdr x4)])
>                               (if (null? x4)
>                                   ((lambda (a4 a3 a2 a1) l)
>                                    (car x4) (car x3) (car x2) (car
> x1))                                   (fail)))
>                             (fail)))
>                       (fail)))
>                 (fail)))
>           (fail))))

Hm. Assuming that cdddar and friends are implemented entirely
in C, I would guess that the original version is faster in an
interpreter -- I won't bet on it though.

--
Jens Axel Søgaard



Posted on the users mailing list.