3 ms·
(map (defn f [c] {:overlap-amount (circle-overlap-distance circle c) :mid-point (mid-point circle c)}) circle-
by dkersten 11y ago
(map
(defn f [c]
{:overlap-amount (circle-overlap-distance circle c)
:mid-point (mid-point circle c)})
circle-list)
Is there a reason this uses defn instead of fn? This is the first time I've seen defn used like this.
Since this expands to something like (def f (fn [c] ... and f is never used anywhere, I'd change it to fn. If f is used, I'd consider letfn instead.
The revised code replaces it with #(...) which is shorthand for (fn [...] ...), but am curious if there was a reason for using defn or if it was just an oversight.
- numergent 11y agoNo particular reason, actually, that was unnecessary. I could also just have done #(hash-map :overlap-amount ... :mid-point ...) I believe it was an independent function initially that I just plunked in there right before setting the gist live, since I wasn't using it anywhere else, but that was back in January.