4

Notes from Learning Clojure

 2 years ago
source link: https://packetlost.dev/blog/notes-from-learning-clojure/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Notes from Learning Clojure

Published on April 4, 2022
  • Typing annotations don't really seem to be the norm, and it can be difficult to identify the shape of data
  • Relies heavily on collection types such as vectors, maps, and lists, exacerbates data shape issue
  • ClojureScript is a pleasant way to write front-ends, especially using something like Rum to really be writing React code
  • The tooling is decent
  • Docs are incredibly important to Clojure, always write them
    • Also, ideally annotate types and describe inputs and outputs well
  • Java interop is handled well, if a bit funny to read
  • Vectors as the definition for function args is nice, relative to other Lisps
  • It's surprising how much logic seems to take place in function arg bindings
  • It's difficult to keep what all the symbols mean in my head
    • I imagine this will go away with time and experience, but even it's own documentation indicates the syntax is "weird"
  • Namespaces are first-class citizens
  • Also, keyword types are awesome
    • They're like fancy namespaced enumerated types
  • When the inevitable very large, very complex function happens, it can be very hard to understand and debug
    • Split things out as much as possible, FP is good at this!
  • Some systems prescribe meaning to datatypes (ie. vector vs list vs map)
    • Datomic, for example, does this heavily. Various behaviors are prescribe to differing data types that otherwise would be equivalent
    • This is also reinforced by the keyword type, which is itself not much more than a namespaced enum, but lets you define behaviors from a first-class language construct that is not just a string or function call and theoretically less prone to error than the former and makes less assumptions about use than the latter

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK