Created
October 18, 2017 13:36
-
-
Save codec-abc/f5b55c4580f5f52ea0735c5e09ccae7a to your computer and use it in GitHub Desktop.
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
| use "files" | |
| use "collections" | |
| use "format" | |
| primitive NoOp | |
| fun noop() => | |
| let a = "noop" | |
| primitive FileReader | |
| fun read_file_lines(path : String, env : Env) : List[String]? => | |
| let file_path = FilePath.create(env.root as AmbientAuth, path)? | |
| let file = File.open(file_path) | |
| let file_line_iterator = FileLines.create(file) | |
| let lines = List[String].create(0) | |
| for a_line in file_line_iterator do | |
| lines.push(a_line) | |
| end | |
| lines | |
| actor Main | |
| new create(env : Env) => | |
| try | |
| let content = FileReader.read_file_lines("data.txt", env)? | |
| for a_line in content.values() do | |
| let y = a_line.split("x") | |
| for z in y.values() do | |
| NoOp.noop() | |
| end | |
| end | |
| else | |
| env.out.print("cannot read file") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment