Lists vs. alists taylanbayirli@xxxxxx (15 Aug 2015 21:13 UTC)
Re: Lists vs. alists John Cowan (16 Aug 2015 00:37 UTC)
Re: Lists vs. alists taylanbayirli@xxxxxx (16 Aug 2015 12:25 UTC)

Lists vs. alists taylanbayirli@xxxxxx 15 Aug 2015 21:13 UTC

Asking the community for input.

Might it be more useful to drop support for list-ref/list-set!, and
support alists instead?

Alternatively, if alists with integers as their keys are very rare,
might it make sense to support non-integer keyed alists only, and keep
support for lists at the same time?

Big disadvantage of the latter idea: it will break code silently when a
programmer forgets about the inconsistency; change the field argument of
a ref or set! call to an integer where it was supposed to be an alist
key, then wonder what the hell went wrong when your code blows up at a
much later time due to a wrong value being stored somewhere, the alist
suddenly losing an entry (the one that was erroneously overwritten via
list-set!), the alist not having valid alist structure anymore (error
while mapping), etc.

So I guess that idea is out although it seems smart and pragmatic at
first.  Having mentioned it here, I'll drop it again unless I somehow
get convinced that the above disadvantage is not a big deal.

Back to the first idea then: how common is list-ref/list-set! in modern
Scheme code that uses vectors and records well?  How common are alists
in modern Scheme code that uses hashtables well?

Taylan