>>107803544
one more nitpick, using case makes it clear what the anon function expects `part` to be:
(defn map-differentiating-last
[f last-f s]
(map (fn [part]
(let [x (part 0)]
(case (count part)
2 (f x)
1 (last-f x))))
(partitionv-all 2 1 s)))
;; some edge cases:
(map-differentiating-last
(fn double [x] (* 2 x))
Comment too long. Click here to view the full text.