cb codes

A Neat Pattern With Juxt

I recently added the function juxt to my toolbox in Clojure.

A good pattern I've discovered is using juxt to perform operations on a data structure and destructuring its return value.

(defn read-files
  [^String path]
  (let [data-files (find-data-files path)
        [prices receipts] ((juxt find-prices-file find-receipt-files) data-files)]
    {:prices (read-prices prices)
     :receipts (apply merge (read-receipts receipts))}))