[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Sequence to sequence conversion
On Sun, Jul 1, 2012 at 10:19 PM, Marc Feeley <feeley@x> wrote:
> The R5RS has the following sequence to sequence conversion procedures:
>
> list->string, and string->list
> list->vector, and vector->list
>
> The R7RS is adding bytevector sequences, but it does not add the conversion procedures:
>
> list->bytevector, and bytevector->list
>
> What is the rationale for this inconsistency?
>
> Moreover, the R7RS is adding only the first set of these conversion procedures:
>
> vector->string, and string->vector
> bytevector->string, and string->bytevector (not in R7RS)
> vector->bytevector, and bytevector->vector (not in R7RS)
Actually, we have the second, it's just named
utf8->string and string->utf8 to emphasize the
encoding used to convert to and from a bytevector.
> yet for consistency they should be added. Why is the conversion between vectors and strings priviledged by the standard?
>
> Personnaly, I think these conversion procedures should not be added to the standard because for consistency, any sequence types added by an implementation of Scheme (or future standard) would require N^2 conversion procedures. Only the conversions to and from lists should be specified, and a "sufficiently intelligent compiler" can handle compositions such as
>
> (list->string (vector->list v))
>
> like the proposed (vector->string v), if performance is an issue.
Bytevectors are a special-purpose data-structure,
for which conversions from general containers are
not necessarily possible (although this is also true
of strings).
I agree we don't need all O(n^2) procedures.
Ticket #433 filed to consider the bytevector
to list (or vector) case.
--
Alex
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports