2014-08-14 14:59 GMT+02:00 Marko Rauhamaa <[email protected]>:
> Panicz Maciej Godek <[email protected]>:
>
>>> I disagree. S-expressions far surpass whatever the others have to offer.
>>
>> You disagree on which point exactly?
>> - that using dictionaries is programmers' daily bread?
>
> No, we are talking about the external representation of hash tables. I'm
> saying the alist format is sufficient to communicate the abstract
> contents of hash tables or any other mapping. You don't need any new
> representation format for hash tables -- or I can't think of a use case.
I agree that it is sufficient. It's just that it isn't handy.
It's more succinct to write
x = {a : 5, b : 10} ...
or
(let ((x '{(a . 5)(b . 10)}))
...)
or
(let ((x '((a . 5)(b . 10))))
...)
than
(let ((x (alist->hash-table '((a . 5)(b . 10)))))
...)
Also, there's less that you (as a programmer) need to memoize, because
otherwise you'd need to check the documentation if it's
alist->hash-table or alist->hash-map or something else. Furthermore,
using alist->hash-table and hash-table->alist adds no value to your
program -- it's there only to optimize lookups, compared to assoc-ref
and assoc-set!, and essentialy has no impact on the semantics of your
program.
(however, weak hash-tables are an exception, because they represent a
concept that wouldn't otherwise be representable using alists)