practicalli / practicalli/practicalli.github.io
Article: How to understand a Clojure function
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 7
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
When learning how to develop with Clojure, an important aspect is to understand what functions already exist and how to use those functions
Finding functions
apropos
clojure cli find function ?
Read the function doc-string
The doc-string should describe the function arguments and hopefully give some indication of the types of values that the function works with
doc-strings for clojure.core functions tend to be on the terse side of things and may not immediately be understood.
Look at the examples at clojuredocs.org
Each page on clojuredocs.org includes the function doc-string and several examples of using the funciton, contributed from the community
Clojure LSP
describe-thing-herewill return the doc-string and examples from clojuredocs.org (TODO: check Clojure LSP is using clojuredocs.org as a source of examples and if all editors support this (or if its just Emacs LSP UI)
Experiment in the REPL
calling the function in the REPL with various arguments, experiment by calling the function with different values
Evaluate the function call to a comment to keep a history of experiment results.
Read the source code of the function
For a deep understanding of a function, or to find further inspiration on how to write Clojure, take a look at the source code of a function.
Clojure LSP and Clojure aware editors allow navigation to the source code of any Clojure function on the Classpath.
clojuredocs.org also includes a link to the source code of the org.clojure/clojure project on GitHub
Clone the org.clojure/clojure project to search through the source code and run searches on the code to find use of a function.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the issue body as the article outline, covering function discovery, doc-strings, clojuredocs.org, REPL experimentation, and source navigation. First verify the TODO about whether Clojure LSP's describe-thing-here uses clojuredocs.org examples and which editors support it. Done means the article is published with accurate guidance and that uncertainty resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100