practicalli / practicalli/clojure
Pure funcitons and explicit arguments
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 117
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
Including magic data, that is accessed outside of a function, makes that function impure and more prone to refactor or create similar code using different magic data.
(den retrieve-customer-account [customer-id]
(slurp (str "https://webservice/customers?" customer-id)))
Where did that webservice URL come from? What happens if it changes, how many places have we hard coded this ??
Generalising the function is also a way to make the function pure. This gives a more generally usable function as well as removing side-effects (side-causes)
(den retrieve [data-source unique-id]
(slurp (str data-source unique-id)))
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
The issue names no file, test, or documentation entry point; first locate where guidance on pure functions and explicit arguments belongs in the repository. Done means the intended guidance and examples are incorporated in a clearly scoped documentation change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100