Skip to content

Commit

Permalink
day19
Browse files Browse the repository at this point in the history
  • Loading branch information
dalurness committed Dec 20, 2024
1 parent ca29706 commit 75bfee1
Showing 1 changed file with 156 additions and 0 deletions.
156 changes: 156 additions & 0 deletions src/content/communitySolutions/19/dalurness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
---
descriptions: ["gleam"]
---

### 2024 Solution Gleam

#### Output

```
Liam: NICE
Emma: NICE
Noah: NICE
Olivia: NICE
Sophia: NICE
Jackson: NICE
Ava: NAUGHTY
Aiden: NAUGHTY
Isabella: NICE
Lucas: NICE
Mia: NICE
Caden: NICE
Charlotte: NAUGHTY
Grayson: NICE
Amelia: NICE
Muhammad: NICE
Harper: NICE
Mason: NICE
Evelyn: NICE
Elijah: NAUGHTY
Abigail: NICE
Oliver: NICE
Emily: NAUGHTY
Jacob: NAUGHTY
Elizabeth: NAUGHTY
Michael: NICE
Mila: NAUGHTY
Alexander: NICE
Ella: NICE
William: NICE
Sofia: NICE
James: NICE
Camila: NICE
Benjamin: NICE
Avery: NAUGHTY
Henry: NICE
Scarlett: NAUGHTY
Daniel: NAUGHTY
Victoria: NICE
Matthew: NAUGHTY
Luna: NAUGHTY
Jackson: NICE
Grace: NICE
Logan: NICE
Chloe: NAUGHTY
Sebastian: NICE
Penelope: NAUGHTY
Levi: NICE
Layla: NICE
Mateo: NICE
Riley: NICE
David: NICE
Zoey: NICE
Samuel: NICE
Nora: NICE
Joseph: NICE
Lily: NICE
John: NICE
Eleanor: NICE
Henry: NICE
Hannah: NICE
Owen: NICE
Lillian: NAUGHTY
Jack: NAUGHTY
Addison: NAUGHTY
Wyatt: NICE
Aubrey: NAUGHTY
Luke: NAUGHTY
Ellie: NICE
Jayden: NICE
Stella: NAUGHTY
Dylan: NAUGHTY
Natalie: NAUGHTY
Nicholas: NICE
Zoe: NICE
Isaac: NICE
Leah: NICE
Olivia: NICE
Hazel: NICE
Charlie: NAUGHTY
Violet: NICE
Gabriel: NICE
Aurora: NICE
Julian: NICE
Savannah: NICE
Caleb: NAUGHTY
Audrey: NAUGHTY
Daniel: NICE
Brooklyn: NAUGHTY
Ryan: NAUGHTY
Claire: NICE
Tyler: NICE
Bella: NICE
William: NICE
Lucy: NICE
Zachary: NICE
Anna: NICE
Nathan: NICE
Samantha: NICE
Thomas: NICE
Genesis: NICE
Peter: NICE
Maya: NICE
Eli: NICE
Lily: NICE
Mateo: NICE
Emilia: NICE
Isaiah: NICE
Valentina: NICE
Anthony: NAUGHTY
Josephine: NICE
Joshua: NAUGHTY
Nova: NICE
Christopher: NICE
Naomi: NICE
Andrew: NAUGHTY
Madison: NICE
```

```gleam
import gleam/int
import gleam/io
import gleam/list
import gleam/string
import simplifile
pub fn main() {
let filename = "bin.txt"
case simplifile.read(filename) {
Ok(file_contents) -> file_contents
Error(_) -> {
io.println("failed to read file: " <> filename)
panic as "failed to read file"
}
}
|> string.split("")
|> list.sized_chunk(8)
|> list.map(fn(l) {
let joined_str = string.join(l, "")
let assert Ok(int_val) = int.base_parse(joined_str, 2)
let assert Ok(cp) = string.utf_codepoint(int_val)
cp
})
|> string.from_utf_codepoints
|> io.println
}
```

0 comments on commit 75bfee1

Please sign in to comment.