4 ms·
Interesting how Clojure takes the complete opposite approach by simply making dicts immutable. https://chasemerick.files.wordpress.com/2011/07/choosingtypeform
by valbaca 4y ago
Interesting how Clojure takes the complete opposite approach by simply making dicts immutable.
https://chasemerick.files.wordpress.com/2011/07/choosingtypeforms2.png https://chasemerick.files.wordpress.com/2011/07/choosingtype...
- andreareina 4y agoClojure also makes working with hashes a whole lot more ergonomic with destructuring and symbol keys.
- fastball 4y agoCould you clarify a bit here? Python also has destructuring for its dicts and I'm not entirely sure what you mean by symbol keys.
- geysersam 4y agoSymbol keys are string keys for the more sophisticated among us. See :some-name vs "some_name". ;)
- iamevn 4y agothey're closer to a (namespace) global enum imo
- andreareina 4y agoPython has tuple destructuring, which can be used with dict.items(). I'm talking about being able to destructure by name not position: name, address = some_dict You could fake it if you could ask for a tuple of specific entries: name, address = some_dict.pluck("name", "address")
- lkrubner 4y agoClojure has established the gold standard for beautiful abstractions that unify broad categories of data types. It's seq interface is elegant and powerful. Python's efforts towards option data typing or strict data typing looks especially clunky, awkward, forced, and painful when compared to Clojure.
- epgui 4y agoYeah, as a clojurist this made me laugh: just like people will naturally feel an urge to fill up conversational silence with words, people can’t seem to be able to go without their classes for more than 5 minutes. I don’t have anything against classes in theory, but I’m of the opinion that 99.9% of classes out there just shouldn’t exist.
- josh_fyi 4y agoYou still need to know what keys to expect. The Clojure map that get replaced with a new map have the same problem as a mutable dict.