Imagine the following code: (let lp ([items '(1 2 3 4 5)]) (match items [(list head rest ...) (cons (* head 2) (lp rest))]))
My gut feeling is "oh, this is just O(n) because it's pulling the top off the list.... quite efficient." But then I realized that: (match '(1 2 3 4 . 5) [(list head rest ...) (* head 2)]) throws an exception because it's a dotted list. But the documentation says that the `list?` predicate is O(n). I'm suddenly fearing, have I been writing O(n^2) code this whole time? Does match against list actually check the whole list every time? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/87lft3xxdo.fsf%40dustycloud.org.