Remix.run Logo
rurban a day ago

Oh my. The most important difference is that a-lists are sorted by order of insertion, hashtables not. That's why a-lists are used for symtabs, allowing shadowing of newer temporary dynamic symbols.

shawn_w a day ago | parent [-]

Insertion-ordered hash tables are a thing, though they usually don't allow duplicates any more than other hash table designs.

Ocaml hash tables have the interesting property where each entry is treated like a stack; inserting an existing key pushes the new value and deleting pops. I've always assumed this is for use with lexically scoped symbol tables in the compiler.