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
type _ ty = | |
| TBool : bool ty | |
| TInt : int ty | |
type _ value = | |
| Bool : bool -> bool value | |
| Int : int -> int value | |
type _ expr = | |
| Value : 'a value -> 'a expr |
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 split s n = | |
let arr = Array.make n 0 in | |
let rec loop j i = | |
if i < String.length s && j < n then | |
let c = s.[i] in | |
if c == ' ' then | |
loop (j + 1) (i + 1) | |
else | |
let () = arr.(j) <- | |
arr.(j) * 10 + (int_of_char c - int_of_char '0') |
NewerOlder