(rontolisp) docs
← Functions

rontolisp:alist-hash-table

(rontolisp:alist-hash-table alist &rest hash-table-initargs)

Builds a hash table from an association list — each (key . value) cons becomes an entry, and the first occurrence of a key wins — passing any trailing arguments on to make-hash-table. A lightweight subset of alexandria:alist-hash-table, so a program can switch to alexandria unchanged. It pairs with rontolisp:json-stringify for turning an alist (like a rontolisp:query-params result or the request headers) into a JSON object.

The default hash-table test is eql, like alexandria:alist-hash-table; pass :test 'equal for string keys that should dedup by content:

The inverse is rontolisp:hash-table-alist.

Backend support

Works on every backend and in every WASM mode (Preview 1 included): the function is written in rontolisp itself (part of the prelude) and is compiled into the program when used.