Main problem I see with your let
code, and is the usual case, is you're using lots of intermediate variables whom only have names in order to exist in the let form
.
The best approach to avoid the overbloat is to use the arrow macro ->
or ->>
For instance you can avoid repo
intermediate variable with
initial-garden-count (-> (garden/get-garden-repo)
(.list-gardens)
count)
None the less, in your particular case you're using all your intermediate variables in your test validation, so you need them on the let statement anyway. Maybe new-garden-id
is the only intermediate you can avoid:
fetched-garden (->> (.add-garden repo new-garden)
(.get-garden repo))
Or using the approach suggested by Chiron:
fechted-gaden (.get-garden repo (.add-garden repo new-garden))