R. Kent Dybvig scripsit:
> > However, we can obviously do much better if we
> > have a string-for-each procedure that is O(N). Unfortunately, we have
> > no portable way to write this procedure without string-ref.
>
> What about:
>
> (define string-for-each
> (lambda (p s)
> (for-each p (string->list s))))
My discussion was meant to assume constant space; if not for space
issues, there is no need for strings at all, as lists and vectors
of characters can do all the work.
--
Only do what only you can do. John Cowan <cowan_at_ccil.org>
--Edsger W. Dijkstra's advice
to a student in search of a thesis
Received on Tue Mar 20 2007 - 16:37:36 UTC