Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; surely there's a cleaner way?
- ;; all-conts gives a list of lists of pairs: (([1 0] [2 0] ...) ... )
- ;; the point is to lookup the 2d coordinate given by a pair and multiply all
- ;; such values in one list together, then choose the largest one
- ;; (see http://projecteuler.net/problem=11)
- (defn find-largest-product [size]
- (->> (all-conts size)
- (map #(->> %
- (map lookup)
- (reduce *)))
- (reduce max)))
- (reduce max (map #(reduce * (map lookup %))
- (all-conts size))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement