(rontolisp) docs
← Functions

rontolisp:plist-hash-table

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

Builds a hash table from a property list — the odd elements are keys, the even elements values — passing any trailing arguments on to make-hash-table. A lightweight subset of alexandria:plist-hash-table, so a program can switch to alexandria unchanged. It pairs with rontolisp:json-stringify for building JSON objects: keyword keys are down-cased, so :name becomes "name".

Objects with several keys work the same way (the key order in the JSON output is backend-specific, like maphash); the table is a real hash table, so its values read back with gethash:

The default hash-table test is eql, like alexandria:plist-hash-table; pass :test 'equal (or any make-hash-table argument) to change it:

The inverse is rontolisp:hash-table-plist.

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.