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)

Re: Lists vs. alists John Cowan 16 Aug 2015 00:37 UTC

Taylan Ulrich Bayırlı/Kammer scripsit:

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

I would say no.  Destructive changes to lists are rare, and destructive
changes to alists are even rarer.  People use alists when they want to
bind new values to keys that can easily be dropped later, making the
old values visible again.

Keep lists for compatibility, and forget alists.

> 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?

Even though alists are O(n), they may have smaller constant overheads
than hashtables, plus the advantage of easy reset as noted above.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
If I have not seen as far as other giants, it’s because I have been
standing on my head.  --Trond Engen