https://github.com/p14n/lets-record
Capture values of a let form for analysis
https://github.com/p14n/lets-record
Last synced: 8 months ago
JSON representation
Capture values of a let form for analysis
- Host: GitHub
- URL: https://github.com/p14n/lets-record
- Owner: p14n
- License: mit
- Created: 2020-04-10T14:04:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-29T09:45:39.000Z (over 4 years ago)
- Last Synced: 2025-10-21T22:58:15.548Z (8 months ago)
- Language: Clojure
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lets-record
Provides the letr form to record all symbol bindings in an atom.
[](https://clojars.org/lets-record)

## Why?
When performing complex calculations, if the result is not as expected it can be useful to see the interim "working out". For example:
```clojure
(let [days (- end-days start-days)
years (/ days 365)
amount (* price quanity)
period-rate (* rate years)
interest (* period-rate amount)]
interest) --> 0.5
```
If the amount of interest charged as incorrect, it would be useful to see what the other values were - is the number of days incorrect? Or perhaps the amount?
Using the letr form:
```clojure
(def record (atom []))
(letr record
[days (- end-days start-days)
years (/ days 365)
amount (* price quanity)
period-rate (* rate years)
interest (* period-rate amount)]
interest) --> 0.5
@record --> [{:days 365 :years 1 :amount 10 :period-rate 0.05 :interest 0.5}]
```
we can access a map of those values from the `record` atom.