[plt-scheme] match.ss performance
> (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