[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-map arg order

From: Dirk Herrmann
Subject: Re: string-map arg order
Date: Thu, 6 Sep 2001 19:14:05 +0200 (MEST)

On 6 Sep 2001, Alex Shinn wrote:

>     Dirk>  (define s <some string>)
>     Dirk>  (define (foo c)
>     Dirk>    (string-set! s (random-index (length s)) (random-character)))
>     Dirk>  (string-for-each foo s)
> Well, the looping of string-for-each is O(n)... in your example, the
> inside of the loop happens to be an O(n) computation (in a style we
> would have to make clear is inefficient).

No, you have to re-calculate the character position in every iteration
(see my latest mail to Marius, which is more explanative).

Best regards
Dirk Herrmann

reply via email to

[Prev in Thread] Current Thread [Next in Thread]