Created
July 28, 2016 23:37
-
-
Save prakhar1989/01dd0be59cb92721f2f3caa31f747457 to your computer and use it in GitHub Desktop.
Hacker Rank Prologue
This file contains 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
let (|>) v f = f v;; | |
let comp f g = (fun x -> f (g x));; | |
let read_ints () : int list = | |
let rec aux nums = | |
try let i = read_int () in aux (i :: nums) | |
with End_of_file -> nums | |
in | |
List.rev (aux []) | |
;; | |
let () = | |
read_ints () | |
|> List.map (fun i -> i * i) | |
|> List.iter (fun i -> (print_endline (string_of_int i))) | |
;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment