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

Re: arithmetic issues

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.

"John.Cowan" <jcowan@xxxxxxxxxxxxxxxxx> writes:

> Granted, Scheme vectors could be implemented as sparse arrays (and Scheme
> strings as cords).  For that matter, both could be implemented as lists,
> given a magic first cell that makes them disjoint from Scheme lists.
> And for that mattter, Scheme lists could be implemented as machine-level
> vectors, provided you are willing to live with all the behind-the-scenes
> copying that would be required.  Numbers could be Church numerals, and so on.
> But if Scheme vectors don't have O(1) performance (actually O(log k) on
> modern hardware) in a given implementation, users are likely to vote
> with their feet.

You seem to have a flat-footed way of thinking about these things.  An
implementation could use sparse arrays for long arrays with empty
space and linear arrays for those which are compact.  What is wrong
with that?

Are you saying people will vote with their feet, leaving an
implementation which provides for a certain kind of array using a
sparse implementation, and choosing instead an implementation which
doesn't provide for that kind at all?

Once again, you are thinking that a Scheme datatype must be wedded to
one and only one implementation.  Wrong!