3 ms·
> Really? Yeah, Lisp can be verbose due to the lack of built-in syntax for things other than lists. Take the Common Lisp syntax/library functions (there's not
by trealira 3y ago
> Really?
Yeah, Lisp can be verbose due to the lack of built-in syntax for things other than lists.
Take the Common Lisp syntax/library functions (there's not really built-in syntax) for hash tables:
https://cl-cookbook.sourceforge.net/hashes.html https://cl-cookbook.sourceforge.net/hashes.html
Compare it with Python dictionary syntax:
https://developers.google.com/edu/python/dict-files https://developers.google.com/edu/python/dict-files
Almost everything that's built-in to other languages has to be given a name that makes sense in Lisp. It makes it more readable in some ways, but also more verbose.
- NikkiA 3y agoalists and plists are a much closer lisp analog to python's dicts though
- deleted 3y ago[deleted]
- trealira 3y agoThat's fair. Dictionary literals aren't really any more concise than a-lists. A-list: (("the" . 50) ("be" . 25)) Dictionary literal: {"the": 50, "be": 25 }
- RodgerTheGreat 3y agoUsing both a-lists and p-lists as mere structural conventions- and thus needing to convert back and forth or write multiple versions of routines to handle each- is a good example of how sexprs provide a superficial veneer of simplicity while inviting cancerous complexity in practice. The Clojure approach of recognizing associative structures as a fundamental building-block and giving them specialized syntax: {:the 50 :be 25} Is a clear-cut improvement.
- NikkiA 3y agoAt the risk of waking Naggum's ghost, plists are performant enough to use everywhere, and an alist can be converted to a plist merely by flattening it. I do covet the way clojure's associations are callable as a lookup method, though.
- vindarel 3y agoPlease use the newer Cookbook! https://lispcookbook.github.io/cl-cookbook/data-structures.html#hash-table https://lispcookbook.github.io/cl-cookbook/data-structures.h... For a short hash-table notation, I now use Serapeum's dict: (dict :a 1 :b 2) and that's it, you now have a hash-table (with a representation than can also be read back in by the lisp reader).
- trealira 3y agoThank you, that's good to know. Apologies for linking an old version of the page; I would edit my comment, but it's too late for me to do so now.