News for hackers. Stuff that matters.
Re:A brief interview with Awk creator Dr. Brian Kernighan by kazinator on Wednesday July 17, 2024 @11:58PM (#40992375)
The "killer feature" of alists is that they are persistent data structures; when we extend a shorter alist to make a longer one, the shorter one is unaffected. Moreover, if the program has only a reference to the tail portion of a longer alist, the head portion can be garbage-collected.

With this, we can correctly implement lexical closures: we simply take the current environment (head of the alist) ssociate it with the lambda body and arguments, and we are done.

Re:A brief interview with Awk creator Dr. Brian Kernighan by kragen on Thursday July 18, 2024 @12:15AM (#40992466)
yes! also when you only have two or three things in them, they are faster than hashing, especially on machines without a data cache. clojure uses hamts for this, thus getting this fp-persistence† as well as efficient lookup in large dictionaries, and chris wellons posted a concise, fast c hamt implementation last year at https://nullprogram.com/blog/2023/09/30/

______

† 'persistent' unfortunately also means 'stored in nonvolatile memory', so i feel the need to disambiguate