In this article EB is saying that this
'{"oranges": 2, "apples": 6, "pears": 5}'
is an unordered set in JSON, while this s-expression
'((ORANGES 2) (APPLES 6) (PEARS 5))
is a nested list, but apparently not an unordered set. He says
Yep, this [the Lisp s-expression] has less punctuation, which is nice. However, now suppose I
want my data to be not just a nested list, but rather a mapping of
fruit names to numbers. And I want it to be an efficient mapping, too.
In other words, I want the JSON'{"oranges": 2, "apples": 6, "pears": 5}'
He goes on to distinguish between ordered and unordered collections. What about the JSON makes it an unordered set, or, as he says, a mapping between fruit and numbers? Why, how is the s-expression lacking? Then there is this discussion on the article, which I wasn’t following so well either.
Further, EB uses this
#S(HASH-TABLE :TEST FASTHASH-EQL (ORANGES . 2) (APPLES . 6) (PEARS . 5))
when I, a beginner, have only seen this sort of thing for hash (emacs lisp example):
(setq hash-of-countries (make-hash-table :test 'equal))
(puthash "Mexico" "MX" hash-of-countries)
(puthash "United States" "USA" hash-of-countries)
What does this #S(HASH-TABLE...
mean? And in general, why is he down on s-expressions versus JSON? Any clearing up would be appreciated.