(rontolisp) docs
← rontolisp Package 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".

The members come out in the plist's order, on every backend (a hash table's walk order, like maphash's, is the order its keys were first stored). 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.