I have a piece of code that tries to get some data from a different services, falling back to the next one if previous fails.
The code look a little bit ugly, though. Any suggestions on how to rewrite it in a more concise way?
(defn get-data [query] (let [data-cached (get-data-from-cache query) data-service-1 (if (nil? data-cached) (get-data-service-1 query) data-cached) data-service-2 (if (nil? data-service-1) (get-data-service-2 query) data-service-1) data (if (nil? data-service-2) (get-data-service-3 query) data-service-2)] data))