[plt-scheme] match.ss performance
Doug Orleans
dougo at ccs.neu.edu
Tue Feb 11 17:03:03 EST 2003
> (pretty-display (syntax-object->datum (expand-to-top-form '(match-let (((a1 a2 a3 a4) l)) l))))
(let ((mv (list l)))
(if (and (pair? mv)
(pair? (car mv))
(pair? (cdar mv))
(pair? (cddar mv))
(pair? (cdddar mv))
(null? (cdr (cdddar mv)))
(null? (cdr mv)))
((lambda (a1 a2 a3 a4) (match-let* () l))
(caar mv)
(cadar mv)
(caddar mv)
(car (cdddar mv)))
(match:error mv)))
Is `cdddar' constant-time, or is `match-let' actually quadratic in the
number of pattern variables? Shouldn't it reuse the pairs as it cdrs
down the list?
--dougo at ccs.neu.edu
More information about the plt-scheme
mailing list