This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Core | |
open Async | |
let parse contents = String.split_lines contents | |
|> String.concat | |
|> String.split_on_chars ~on:[','] | |
|> List.map ~f:Int.of_string | |
let read_then_sort fs = | |
let ds = List.map ~f:Reader.file_contents fs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Core | |
open Async | |
let add_all file = | |
Reader.file_contents file >>= fun contents -> | |
let ls = String.split_lines contents in | |
let ss = String.split_on_chars (String.concat ls) ~on:[','] in | |
let ns = List.map ss ~f:Int.of_string in | |
let sum = List.fold_left ns ~init:0 ~f:(+) in | |
printf "%d\n" sum; |
NewerOlder