News for hackers. Stuff that matters.
Re:Why Lisp Failed (2010) by flavio81 on Sunday July 07, 2019 @09:01PM (#20379120)
>honest question: is the following the way you do hashmaps in lisp: ?

>vs

>a = { color:'brown', name:'fred' }

For such simple data you don't need to use a hashtable in Lisp. You just do:

(:color "brown" :name "fred")

then you get the name using:

(getf x :name)

Btw, anything you can represent in JSON, you can also represent in Lisp s-expressions. But not the other way around(!)

Hashtables, in Common Lisp, are intended for big amounts of data, that's why CL includes several options to tune their performance.

Re:Why Lisp Failed (2010) by dreamcompiler on Monday July 08, 2019 @12:15AM (#20379846)
> (:color "brown" :name "fred")

This works, but it's a plist and thus O[n] for lookup. I assumed the questioner wanted an O[1] data structure; thus a hash table is the better answer. (Granted it makes little difference when n is small.)

Re:Why Lisp Failed (2010) by flavio81 on Monday July 08, 2019 @02:37PM (#20385453)
>This works, but it's a plist and thus O[n] for lookup. I assumed the questioner wanted an O[1] data structure; thus a hash table is the better answer. (Granted it makes little difference when n is small.)

There was a test on some Common Lisp implementations, of hashtables versus plists on access speeds.

On small (<30?) datasets, plists were much faster than hashtables. Bigger than that, the constant access speed of hashtables makes HTs a more sane choice.

The other thing is memory consumption -- on CL, plists are very frugal.