~ngp

Notes from Learning Clojure

  • 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, keywords 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
Thoughts? Leave a comment

Comments
  1. ngp — Apr 4, 2022:

    I might periodically update this as I make note of more things