Skip to content

Commit 6deda94

Browse files
committed
Uiua/2015/04: add solution
1 parent 142f4b7 commit 6deda94

File tree

8 files changed

+126
-2
lines changed

8 files changed

+126
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@
9393
|[**19**](https://adventofcode.com/2016/day/19) [<img height=12 src=".assets/py.svg">](Python/2016/19.py "Python solution for 2016/19")|[**20**](https://adventofcode.com/2016/day/20) [<img height=12 src=".assets/py.svg">](Python/2016/20.py "Python solution for 2016/20")|[**21**](https://adventofcode.com/2016/day/21) [<img height=12 src=".assets/py.svg">](Python/2016/21.py "Python solution for 2016/21")|[**22**](https://adventofcode.com/2016/day/22) [<img height=12 src=".assets/py.svg">](Python/2016/22.py "Python solution for 2016/22")|[**23**](https://adventofcode.com/2016/day/23) [<img height=12 src=".assets/py.svg">](Python/2016/23.py "Python solution for 2016/23")|[**24**](https://adventofcode.com/2016/day/24) [<img height=12 src=".assets/py.svg">](Python/2016/24.py "Python solution for 2016/24")|[**25**](https://adventofcode.com/2016/day/25) [<img height=12 src=".assets/py.svg">](Python/2016/25.py "Python solution for 2016/25")|
9494
|26|27|28|29|30|31||
9595

96-
## [2015](https://adventofcode.com/2015) ([<img height=18 src=".assets/py.svg"> Python](Python/2015): 25/25 | [<img height=18 src=".assets/rs.svg"> Rust](Rust/2015): 7/25 | [<img height=18 src=".assets/ua.png"> Uiua](Uiua/2015): 5/25 | [<img height=18 src=".assets/nix.svg"> Nix](Nix/2015): 1/25 | [<img height=18 src=".assets/nu.svg"> Nu](Nu/2015): 1/25)
96+
## [2015](https://adventofcode.com/2015) ([<img height=18 src=".assets/py.svg"> Python](Python/2015): 25/25 | [<img height=18 src=".assets/rs.svg"> Rust](Rust/2015): 7/25 | [<img height=18 src=".assets/ua.png"> Uiua](Uiua/2015): 6/25 | [<img height=18 src=".assets/nix.svg"> Nix](Nix/2015): 1/25 | [<img height=18 src=".assets/nu.svg"> Nu](Nu/2015): 1/25)
9797
|Mo|Tu|We|Th|Fr|Sa|Su|
9898
|-|-|-|-|-|-|-|
99-
||[**1**](https://adventofcode.com/2015/day/1) [<img height=12 src=".assets/rs.svg">](Rust/2015/01.rs "Rust solution for 2015/01") [<img height=12 src=".assets/py.svg">](Python/2015/01.py "Python solution for 2015/01") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgotwqwuPUAoCuKKgygrMeKKl8KvMVwrKS8rCg== "Uiua solution for 2015/01") [<img height=12 src=".assets/nix.svg">](Nix/2015/01.nix "Nix solution for 2015/01") [<img height=12 src=".assets/nu.svg">](Nu/2015/01.nu "Nu solution for 2015/01")|[**2**](https://adventofcode.com/2015/day/2) [<img height=12 src=".assets/rs.svg">](Rust/2015/02.rs "Rust solution for 2015/02") [<img height=12 src=".assets/py.svg">](Python/2015/02.py "Python solution for 2015/02") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqc4ouV4omgQHguKeKJoEBcbi4KCuKIqSgvKyspIOKJoeKKgygvw5d8w5cyLeKKgy_ihqUvK3zDt-KKgy_ihqUvw5d8w5cyLyvip4jDl-KGr1s0XSkK "Uiua solution for 2015/02")|[**3**](https://adventofcode.com/2015/day/3) [<img height=12 src=".assets/rs.svg">](Rust/2015/03.rs "Rust solution for 2015/03") [<img height=12 src=".assets/py.svg">](Python/2015/03.py "Python solution for 2015/03") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipc64oqZ4pa9OuKXoeKIiiI8Xj52Igriio_iiplb4peh4oipwq_iirjih4zih6EyXQoK4oqDKOKkuDHihq_iiJ5fMl8yfMKkKQriiKko4qe74pe04oqCMF8wL-KKguKJoVwrKQo= "Uiua solution for 2015/03")|[**4**](https://adventofcode.com/2015/day/4) [<img height=12 src=".assets/rs.svg">](Rust/2015/04.rs "Rust solution for 2015/04") [<img height=12 src=".assets/py.svg">](Python/2015/04.py "Python solution for 2015/04")|[**5**](https://adventofcode.com/2015/day/5) [<img height=12 src=".assets/rs.svg">](Rust/2015/05.rs "Rust solution for 2015/05") [<img height=12 src=".assets/py.svg">](Python/2015/05.py "Python solution for 2015/05") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipzilqHiiaBAXG4uCgpBIOKGkCAvw5db4oqDKOKJpTMvK-KIiiJhZWlvdSJ8L-KGpeKniD18wqwv4oal4pmt4omh4oyVImFiIl8iY2QiXyJwcSJfInh5IsKkKV0KQiDihpAgw5fiioMo4omlMi_ihqXima3iiaHiprfip4jiiJgy4p-cwqR8L-KGpT3iioPiiqLiiqPijYnip4jiiJgzKQoK4oipLyviiaHil4fiioNCIEEK "Uiua solution for 2015/05")|[**6**](https://adventofcode.com/2015/day/6) [<img height=12 src=".assets/rs.svg">](Rust/2015/06.rs "Rust solution for 2015/06") [<img height=12 src=".assets/py.svg">](Python/2015/06.py "Python solution for 2015/06") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqZW-KIqeKIqeKLlV0g4o2jKAogICAg4omNIm9uIsKwJCJ0dXJuIF8gXyxfIHRocm91Z2ggXyxfIgogIHwgMsKwJCJ0b2dnbGUgXyxfIHRocm91Z2ggXyxfIikKKeKJoEBcbi4KCuKKmeKKmSjihq9bLjEwMDBdMCkKClNvbHZlISDihpAgLyvima3iiKco4o2c4oqhKF4wOikg4o2c4o2c4o2JLSjima3igoLih6EpIOKKmSgrMSniiKniip_CsFviipniipniipniiJhd4oqZOjopCuKKg1NvbHZlIeKorCjihqUwLTF8KzF8KzIpIFNvbHZlIeKorCjihqcwfOKGpTF8wqwpCg== "Uiua solution for 2015/06")|
99+
||[**1**](https://adventofcode.com/2015/day/1) [<img height=12 src=".assets/rs.svg">](Rust/2015/01.rs "Rust solution for 2015/01") [<img height=12 src=".assets/py.svg">](Python/2015/01.py "Python solution for 2015/01") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgotwqwuPUAoCuKKgygrMeKKl8KvMVwrKS8rCg== "Uiua solution for 2015/01") [<img height=12 src=".assets/nix.svg">](Nix/2015/01.nix "Nix solution for 2015/01") [<img height=12 src=".assets/nu.svg">](Nu/2015/01.nu "Nu solution for 2015/01")|[**2**](https://adventofcode.com/2015/day/2) [<img height=12 src=".assets/rs.svg">](Rust/2015/02.rs "Rust solution for 2015/02") [<img height=12 src=".assets/py.svg">](Python/2015/02.py "Python solution for 2015/02") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqc4ouV4omgQHguKeKJoEBcbi4KCuKIqSgvKyspIOKJoeKKgygvw5d8w5cyLeKKgy_ihqUvK3zDt-KKgy_ihqUvw5d8w5cyLyvip4jDl-KGr1s0XSkK "Uiua solution for 2015/02")|[**3**](https://adventofcode.com/2015/day/3) [<img height=12 src=".assets/rs.svg">](Rust/2015/03.rs "Rust solution for 2015/03") [<img height=12 src=".assets/py.svg">](Python/2015/03.py "Python solution for 2015/03") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipc64oqZ4pa9OuKXoeKIiiI8Xj52Igriio_iiplb4peh4oipwq_iirjih4zih6EyXQoK4oqDKOKkuDHihq_iiJ5fMl8yfMKkKQriiKko4qe74pe04oqCMF8wL-KKguKJoVwrKQo= "Uiua solution for 2015/03")|[**4**](https://adventofcode.com/2015/day/4) [<img height=12 src=".assets/rs.svg">](Rust/2015/04.rs "Rust solution for 2015/04") [<img height=12 src=".assets/py.svg">](Python/2015/04.py "Python solution for 2015/04") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=IyBFeHBlcmltZW50YWwhCgomc2MKCuKWveKKuOKJoEBcbgoKfiAiLi4vdXRpbHMvbGliLnVhIiB-IE1E4oKFCgpaZXJvZXMg4oaQIOKMisO3NC8rXOKGp8Ks4pmt4omh4oeM4ouvTUTigoUkIl9fIjoKTWluZSAgIOKGkCDii4Xiipnil4zijaIo4oqZK-KCgXw84oqZWmVyb2VzKQoKTWluZSA2IOKfnDriirhNaW5lIDUgMQo= "Uiua solution for 2015/04")|[**5**](https://adventofcode.com/2015/day/5) [<img height=12 src=".assets/rs.svg">](Rust/2015/05.rs "Rust solution for 2015/05") [<img height=12 src=".assets/py.svg">](Python/2015/05.py "Python solution for 2015/05") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipzilqHiiaBAXG4uCgpBIOKGkCAvw5db4oqDKOKJpTMvK-KIiiJhZWlvdSJ8L-KGpeKniD18wqwv4oal4pmt4omh4oyVImFiIl8iY2QiXyJwcSJfInh5IsKkKV0KQiDihpAgw5fiioMo4omlMi_ihqXima3iiaHiprfip4jiiJgy4p-cwqR8L-KGpT3iioPiiqLiiqPijYnip4jiiJgzKQoK4oipLyviiaHil4fiioNCIEEK "Uiua solution for 2015/05")|[**6**](https://adventofcode.com/2015/day/6) [<img height=12 src=".assets/rs.svg">](Rust/2015/06.rs "Rust solution for 2015/06") [<img height=12 src=".assets/py.svg">](Python/2015/06.py "Python solution for 2015/06") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqZW-KIqeKIqeKLlV0g4o2jKAogICAg4omNIm9uIsKwJCJ0dXJuIF8gXyxfIHRocm91Z2ggXyxfIgogIHwgMsKwJCJ0b2dnbGUgXyxfIHRocm91Z2ggXyxfIikKKeKJoEBcbi4KCuKKmeKKmSjihq9bLjEwMDBdMCkKClNvbHZlISDihpAgLyvima3iiKco4o2c4oqhKF4wOikg4o2c4o2c4o2JLSjima3igoLih6EpIOKKmSgrMSniiKniip_CsFviipniipniipniiJhd4oqZOjopCuKKg1NvbHZlIeKorCjihqUwLTF8KzF8KzIpIFNvbHZlIeKorCjihqcwfOKGpTF8wqwpCg== "Uiua solution for 2015/06")|
100100
|[**7**](https://adventofcode.com/2015/day/7) [<img height=12 src=".assets/rs.svg">](Rust/2015/07.rs "Rust solution for 2015/07") [<img height=12 src=".assets/py.svg">](Python/2015/07.py "Python solution for 2015/07")|[**8**](https://adventofcode.com/2015/day/8) [<img height=12 src=".assets/py.svg">](Python/2015/08.py "Python solution for 2015/08")|[**9**](https://adventofcode.com/2015/day/9) [<img height=12 src=".assets/py.svg">](Python/2015/09.py "Python solution for 2015/09")|[**10**](https://adventofcode.com/2015/day/10) [<img height=12 src=".assets/py.svg">](Python/2015/10.py "Python solution for 2015/10")|[**11**](https://adventofcode.com/2015/day/11) [<img height=12 src=".assets/py.svg">](Python/2015/11.py "Python solution for 2015/11")|[**12**](https://adventofcode.com/2015/day/12) [<img height=12 src=".assets/py.svg">](Python/2015/12.py "Python solution for 2015/12")|[**13**](https://adventofcode.com/2015/day/13) [<img height=12 src=".assets/py.svg">](Python/2015/13.py "Python solution for 2015/13")|
101101
|[**14**](https://adventofcode.com/2015/day/14) [<img height=12 src=".assets/py.svg">](Python/2015/14.py "Python solution for 2015/14")|[**15**](https://adventofcode.com/2015/day/15) [<img height=12 src=".assets/py.svg">](Python/2015/15.py "Python solution for 2015/15")|[**16**](https://adventofcode.com/2015/day/16) [<img height=12 src=".assets/py.svg">](Python/2015/16.py "Python solution for 2015/16")|[**17**](https://adventofcode.com/2015/day/17) [<img height=12 src=".assets/py.svg">](Python/2015/17.py "Python solution for 2015/17")|[**18**](https://adventofcode.com/2015/day/18) [<img height=12 src=".assets/py.svg">](Python/2015/18.py "Python solution for 2015/18")|[**19**](https://adventofcode.com/2015/day/19) [<img height=12 src=".assets/py.svg">](Python/2015/19.py "Python solution for 2015/19")|[**20**](https://adventofcode.com/2015/day/20) [<img height=12 src=".assets/py.svg">](Python/2015/20.py "Python solution for 2015/20")|
102102
|[**21**](https://adventofcode.com/2015/day/21) [<img height=12 src=".assets/py.svg">](Python/2015/21.py "Python solution for 2015/21")|[**22**](https://adventofcode.com/2015/day/22) [<img height=12 src=".assets/py.svg">](Python/2015/22.py "Python solution for 2015/22")|[**23**](https://adventofcode.com/2015/day/23) [<img height=12 src=".assets/py.svg">](Python/2015/23.py "Python solution for 2015/23")|[**24**](https://adventofcode.com/2015/day/24) [<img height=12 src=".assets/py.svg">](Python/2015/24.py "Python solution for 2015/24")|[**25**](https://adventofcode.com/2015/day/25) [<img height=12 src=".assets/py.svg">](Python/2015/25.py "Python solution for 2015/25")|26|27|

Uiua/2015/04.ua

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Experimental!
2+
3+
&fras ⊣ &args
4+
5+
▽⊸≠@\n
6+
7+
~ "../utils/lib.ua" ~ MD₅
8+
9+
Zeroes ← ⌊÷4/+\↧¬♭≡⇌⋯MD₅$"__":
10+
Mine ← ⋅⊙◌⍢(⊙+₁|<⊙Zeroes)
11+
12+
Mine 6 ⟜:⊸Mine 5 1

Uiua/utils/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libutils.so

Uiua/utils/Cargo.lock

+77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Uiua/utils/Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "utils"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[lib]
7+
crate-type = ["cdylib"]
8+
9+
[dependencies]
10+
md-5 = "0.10.6"

Uiua/utils/build.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
target=$(cargo metadata --format-version=1 | jq -r .target_directory)
6+
cargo build -r
7+
cp "$target/release/libutils.so" .

Uiua/utils/lib.ua

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Experimental!
2+
3+
Lib ↚ &ffi⊂□"./utils/libutils.so"
4+
5+
MD₅ ← Lib {$"{_}"/⊂↯16"unsigned char;" "md5" "const unsigned char:1" "unsigned long"} □₁

Uiua/utils/src/lib.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use std::slice;
2+
3+
use md5::{Digest, Md5};
4+
5+
#[repr(C)]
6+
pub struct Md5Digest([u8; 16]);
7+
8+
#[unsafe(no_mangle)]
9+
pub unsafe extern "C" fn md5(data: *const u8, len: usize) -> Md5Digest {
10+
let data = unsafe { slice::from_raw_parts(data, len) };
11+
Md5Digest(*Md5::new().chain_update(data).finalize().as_ref())
12+
}

0 commit comments

Comments
 (0)