Clean up day 1
This commit is contained in:
parent
b17f36064c
commit
137c751f44
14
day_1.sml
14
day_1.sml
@ -1,13 +1,13 @@
|
||||
val file = TextIO.openIn "day_1.txt";
|
||||
fun sortAsc (l: int list) : int list = ListMergeSort.sort (op >) l
|
||||
|
||||
fun sum (l: int list) : int = foldl (op +) 0 l
|
||||
|
||||
fun substrToInt (substr: substring) : int = valOf (Int.fromString (Substring.string substr))
|
||||
|
||||
val file = TextIO.openIn "day_1.txt"
|
||||
val input = TextIO.inputAll file;
|
||||
TextIO.closeIn file;
|
||||
|
||||
fun sortAsc (l: int list) : int list = ListMergeSort.sort (fn (a, b) => a > b) l
|
||||
|
||||
fun sum (l: int list) : int = foldl (fn (a, b) => a + b) 0 l
|
||||
|
||||
fun substrToInt(substr: substring) : int = valOf (Int.fromString (Substring.string substr))
|
||||
|
||||
val lines = String.tokens (fn (char) => char = #"\n") input
|
||||
|
||||
val pairs = map
|
||||
|
Loading…
Reference in New Issue
Block a user