Problem 13
Ruby
1 1 data = ''
2 2 sum = 0
3 3 f = File.open("problem13.txt", "r")
4 4 f.each_line do |line|
5 5 sum += line.to_i
6 6 end
7 7 sum = sum.to_s.split(//);
8 8 ans = ''
9 9 for index in 0 ... 10
10 10 ans += sum[index].inspect
11 11 end
12 12 puts"#{ans.tr'"',''}"
Clojure
1(defn -main
2 []
3 (println (subs (str (reduce + (map clojure.edn/read-string (clojure.string/split-lines (slurp *in*))))) 0 10)))
4