use .field exps in AOC day 1

This commit is contained in:
2020-12-01 15:46:25 -07:00
parent 638bce5483
commit 4775ff41da

View File

@@ -15,13 +15,14 @@
(when !(= 257778836 (* a b c)) (when !(= 257778836 (* a b c))
(throw "trioWithSum is broken")))) (throw "trioWithSum is broken"))))
// TODO implement .method readerexps and use them instead of let:
(defun readLines [file] (defun readLines [file]
(let [content (File.getContent file) (.filter
lines (content.split #|"\n"|#) (.map
trimmed (lines.map StringTools.trim) // TODO implement escape sequences in kiss string literals
filtered (lines.filter (lambda [l] (< 0 l.length)))] (.split (File.getContent file) #|"\n"|#)
filtered)) StringTools.trim)
(lambda [l] (< 0 l.length))))
(defun readInts [file] (let [lines (readLines file)] (lines.map Std.parseInt))) (defun readInts [file] (let [lines (readLines file)] (lines.map Std.parseInt)))
(defun :kiss.List<Int> pairWithSum [sum :kiss.List<Int> numbers] (defun :kiss.List<Int> pairWithSum [sum :kiss.List<Int> numbers]