I keep flipping between Clojure and CL. I like functional programming, so I really like the workflow of Clojure, but the more-interactive nature of CL is incredibly appealing and I like that it doesn’t put so many constraints on you. I love how you can inspect everything and dig into the core of the language so easily and the interactive debugger is insanely cool.
But I just find it so painful to use, all the functions have strange names, docs are shaky especially for libraries, and I just keep bouncing off. I am going to try Advent of Code in CL this year, but I always get tied up in knots with the data manipulation, especially how you seemingly need to use the loop macro for basically everything since there aren’t that many data structure manipulation methods in the standard library. Hashes are also pretty awkward to work with compared to Java Maps or clojure maps.
Also, I can’t shake the feeling that doing all my data manipulation with linked lists is horribly slow, especially since they aren’t lazily evaluated.
ASDF and the package system is like no other language I’ve ever used, which always ties me in knots, too.
Does anyone have any tips? Is there something I’m missing regarding data manipulation, or is it more a matter of breaking through the pain barrier with practice?
yeah I agree there’s a pain barrier… I don’t shy away from using libraries that make my life easier:
hash-tables: f* yes, I’m frustrated by their verbosity and that they don’t show their content on print. => use Serapeum’s
dict
andtoggle-pretty-print-hash-table
. https://github.com/ruricolist/serapeum/blob/master/REFERENCE.md#dict-rest-keys-and-valuesI use
access
for a generic access to alists, plists, hash-tables, object slots… until I feel it’s too slow, but that’s not often, given I mostly do web. https://lispcookbook.github.io/cl-cookbook/data-structures.html#appendix-a---generic-and-nested-access-of-alists-plists-hash-tables-and-clos-slotsdata structure manipulation methods: see above link, hope it helps, and awesome-cl#data-structures for ideas. For instance, what about https://git.sr.ht/~fosskers/cl-transducers (“a “modern” API with map, filter, take, repeat, cycle, fold…”) (below under “Iteration”). I know I always paste those links but damn I wish I had them when starting ;)
for the official one: https://cl-community-spec.github.io/pages/index.html (interactive search, oh my!) and novaspec.org/ (not open-sourced, waiting if possible)
for libraries, I’ll say that today we can afford the luxury to ignore libraries with bad doc, we’ll find another with decent ones. Let’s find examples?
You can keep the same ASDF snippets between projects and be done with it.
Welcome to Discord to rant freely https://discord.gg/hhk46CE