[gambit-list] table-update! primitive

Marc Feeley feeley at iro.umontreal.ca
Sat Oct 26 16:31:09 EDT 2019


I’m currently reimplementing tables, so it is a good time to consider this.

However, the “obvious” implementation which does one lookup will not work because the update procedure may cause the gc hash table to be resized.  So a lookup must be done before and after the update procedure is executed.  However it is possible to avoid repeating some type checks.

Marc



> On Oct 26, 2019, at 12:45 PM, Dimitris Vyzovitis <vyzo at hackzen.org> wrote:
> 
> Marc,
> 
> Can we add a table-update! primitive? 
> Updates are currently slow because they need two lookups in the hash table, one to find the current value (if any) and one to set it.
> The canonical signature is (table-update! table key update default), where update is applied to the current value, using default if the value is unset.
> 
> -- vyzo





More information about the Gambit-list mailing list