Provides the letr form to record all symbol bindings in an atom.
When performing complex calculations, if the result is not as expected it can be useful to see the interim "working out". For example:
(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:
(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.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close