|
From: | Luca Saiu |
Subject: | Re: substitution in a list |
Date: | Wed, 24 Jan 2007 06:42:31 +0100 |
User-agent: | Thunderbird 1.5.0.7 (X11/20060928) |
Ian Grant wrote:
It would be a good idea to do it this way if the list of substitutions were much longer than the list where they are being made. But if the substitution list is short then looking up a symbol is relatively cheap compared to consing up the transformed list and reversing it, so it would be better to test each symbol once.
An asymptotically optimal solution would be making a hash from the alist, and iterating on the (reversed) list just once, as you do; I guess I'd go for it in a practical case.
I was just trying to be didactic. :-) -- Luca Saiu, maintainer of GNU epsilon http://www.gnu.org/software/epsilon http://www.di.unipi.it/~saiu
[Prev in Thread] | Current Thread | [Next in Thread] |