-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07f34a5
commit 3dd70d5
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import gleam/list | ||
import gleam/io | ||
import gleam/result | ||
import gleam/string | ||
import simplifile | ||
import utils | ||
|
||
pub fn part1() { | ||
// use file <- result.try(utils.read_file("day1.input")) | ||
|
||
let file = case utils.read_file("day1.input") { | ||
Ok(s) -> s | ||
_ -> "dunno" | ||
} | ||
let lines = string.split(file, "\n") | ||
|
||
} | ||
|
||
pub fn part2() { | ||
let file = utils.read_file("day2.input") | ||
let lines = string.split(file, "\n") | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import gleam/io | ||
import gleave | ||
import simplifile | ||
|
||
pub fn read_file(path: String) -> Result(String, String) { | ||
case simplifile.read(path) { | ||
Ok(result) -> Ok(result) | ||
Error(_reason) -> { | ||
io.println_error("Failed to read file!") | ||
gleave.exit(1) | ||
Error("failed") | ||
} | ||
} | ||
} |