MAP contains concatenation of STR(key)-value pairs. Keys must be non-empty, unique and length-first bytewise ascending ordered.
MAP [STR(KEY0) || ITEM0 || STR(KEY1) || ITEM1 || ... ] EOC
Hint: Encoding code for known format can be ordered itself to emit values in an already properly sorted way.
SET is emulated by using MAPs with NIL values. That gives only 1-byte overhead for each element, but reuses already existing code.
Example representations:
MAP[foo: LIST["bar"]] | 09 C3666F6F 08 C3626172 00 00 |
SET[sig, dh] | 09 C26468 01 C3736967 01 00 |