SHARE
TWEET

Untitled

a guest Dec 1st, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn required-fuel [mass]
  2.   (- (int (Math/floor (/ mass 3))) 2))
  3.  
  4. (->> input
  5.      (map required-fuel)
  6.      (reduce + 0)) ;; => 3452245
  7.  
  8. (with-open [r (clojure.java.io/reader "/tmp/input")]
  9.   (->> (line-seq r)
  10.        (filter not-empty)
  11.        (map #(Integer/valueOf %))
  12.        (map required-fuel)
  13.        (reduce + 0))) ;; => 3452245
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top