Finding functions with the clojure cheatsheet
When moving between languages built-in functions always end up with different names. In ruby the
reject method will remove functions from a list using a predicate. It has the same name in underscore. In haskell it is called
deleteBy. Do you know what it is called in clojure?
Use the Clojure cheatsheet
The clojure cheatsheet is a great resource when problems like this occur. You know what you want to do, and what kind of data it interacts with, but just can’t quite name it.
The clojure cheatsheet is also great for function discovery. There have been times where I want to do something related to composition or argument threading, but
-> just doesn’t work. Looking at the cheatsheet around
-> provides the other threading macros. I’ve used
cond-> to make significant cleanups in my code, but would have missed them without the reference.
Links to examples
Additionally, the online cheatsheet version is connected to clojuredocs. With this you can click through and see examples of how to use any of the functions. Do you know how to use
:while? There are examples that show the syntax and result.
There are other sites too
There are other cheatsheet and reference sites such as the clojuredocs quickref or grimoire. They provide similar information, but provide different views and interactions. Try them out, and see which one works best for your workflow.