From f0be378b5acd1e441215b0d1e3fa20172935228f Mon Sep 17 00:00:00 2001 From: aprzn Date: Sat, 9 Dec 2023 03:58:10 -0500 Subject: [PATCH] uiua fmt --- day01.ua | 2 +- day02.ua | 8 ++++---- day03.ua | 6 +++--- day04.ua | 2 +- day05.ua | 28 ++++++++++++++-------------- day06.ua | 6 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/day01.ua b/day01.ua index d7df02b..a1be386 100644 --- a/day01.ua +++ b/day01.ua @@ -1,6 +1,6 @@ PartI ← ( ▽×⊃(≤@9|≥@0|∘) # digits only - parse⊟⊃(⊢|⊢⇌) # add them together + ⋕⊟⊃(⊢|⊢⇌) # add them together ) PartII ← ( diff --git a/day02.ua b/day02.ua index 2f953af..0d295e8 100644 --- a/day02.ua +++ b/day02.ua @@ -10,10 +10,10 @@ TestInput ← # Original parsing solution Colors ← {"red" "green" "blue"} Parse ← ( - ⊔⊢⇌↘1 regex "Game (\\d+): (.*)" - ⊜(□⊜(⇌⊜((parse⊔⋅∘|⊙;)<3.⊃(⊗⊙Colors|∘)□)≠@ .)≠@,.)≠@;. + °□⊢⇌↘1 regex "Game (\\d+): (.*)" + ⊜(□⊜(⇌⊜((⋕°□⋅∘|⊙;)<3.⊃(⊗⊙Colors|∘)□)≠@ .)≠@,.)≠@;. ≡( - ∧(⍜⊡+⊙:⍘⊟)⊃⊔0_0_0 + ∧(⍜⊡+⊙:°⊟)⊃°□0_0_0 ) ) @@ -21,7 +21,7 @@ Parse ← ( ColorsII ← "rgb" ParseII ← ( ↘+2⊗@:. - ⬚0⊜(⊕∘⍘⊟⍉∵(⊟⊃(⊗⊙ColorsII⊢|parse↘2)⇌⊔) regex "\\d+ [rgb]")≠@;. + ⬚0⊜(⊕∘°⊟⍉∵(⊟⊃(⊗⊙ColorsII⊢|⋕↘2)⇌°□) regex "\\d+ [rgb]")≠@;. ↯¯1_3 ) diff --git a/day03.ua b/day03.ua index 36ac2c7..1447675 100644 --- a/day03.ua +++ b/day03.ua @@ -12,8 +12,8 @@ TestInput ← Table ← ⊜(⊂:@.)≠@\n. Adjacency ← ↯¯1_2-1⇡3_3 -Numbers ← ⊜parse×⊃(≤@9|≥@0).♭ -Classify ← ⍜(♭|⍜(⊜□|≡(□↯⧻⊔)⊃(∘|+@\x80⇡⧻))×⊃(≤@9|≥@0).) +Numbers ← ⊜⋕×⊃(≤@9|≥@0).♭ +Classify ← ⍜(♭|⍜(⊜□|≡(□↯⧻°□)⊃(∘|+@\x80⇡⧻))×⊃(≤@9|≥@0).) PartI ← ( ×⊃(<@\x80|≠@.|∘) @@ -25,7 +25,7 @@ PartII ← ( ⊚=@*. ⊠+:Adjacency ≡(□⊝▽≥@\x80.≡(⊡)⊙¤)⊙¤ - /+≡(/×⊏-@\x80⊔)⊙¤▽=2≡⧻. + /+≡(/×⊏-@\x80°□)⊙¤▽=2≡⧻. ) ⊃(Classify|Numbers) Table TestInput diff --git a/day04.ua b/day04.ua index 17351c0..5a450d7 100644 --- a/day04.ua +++ b/day04.ua @@ -6,7 +6,7 @@ $ Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36 $ Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11 TestInput ← -Parse ← ∩(⊜parse≠@ .⊔)⍘⊟⊏1_3 ⊢regex "((\\d+\\s+)+)\\|((\\s+\\d+)+)" +Parse ← ∩(⊜⋕≠@ .°□)°⊟⊏1_3 ⊢regex "((\\d+\\s+)+)\\|((\\s+\\d+)+)" PartIPre ← ⌊ⁿ:2-1/+♭⊞=Parse PartIPost ← /+ diff --git a/day05.ua b/day05.ua index 53ebf14..8e8f718 100644 --- a/day05.ua +++ b/day05.ua @@ -34,19 +34,19 @@ $ 56 93 4 TestInput ← PartI ← ( - ↘6⊔⊃⊢(↘1)⊜□≠@\n. + ↘6°□⊃⊢(↘1)⊜□≠@\n. ⊓( - ⊜parse≠@ . + ⊜⋕≠@ . | ∧( - >@9⊢.⊔ - (⍜(⊔⊢⇌|(⊂|¤;)type.):⊜parse≠@ .|⊂⊙i;) + >@9⊢.°□ + (⍜(°□⊢⇌|(⊂|¤;)type.):⊜⋕≠@ .|⊂⊙i;) )⊙{} ) ∧( +×⊙¬⊃⋅∘( - ⊓⊔¤ + ⊓°□¤ ∩/+≡( - ⍘[⊙⊙∘] + °[⊙⊙∘] ×⊃(≥⋅⊙⋅∘|<+⋅⊙⊙∘|:-:⊙⊙⋅∘) ⊃∘×⊙+ ) @@ -56,27 +56,27 @@ PartI ← ( Prune ← ▽≡(≠0⊢⇌). PartII ← ( - ↘6⊔⊃⊢(↘1)⊜□≠@\n. + ↘6°□⊃⊢(↘1)⊜□≠@\n. ⊓( - ↯¯1_2⊜parse≠@ . + ↯¯1_2⊜⋕≠@ . | ∧( - >@9⊢.⊔ + >@9⊢.°□ ( - ⊜parse≠@ . - ⍜⍘[⊙⊙∘]⊃(⋅∘|⋅⋅∘|-:) - ⍜(⊔⊢⇌|(⊂|¤;)type.): + ⊜⋕≠@ . + ⍜°[⊙⊙∘]⊃(⋅∘|⋅⋅∘|-:) + ⍜(°□⊢⇌|(⊂|¤;)type.): | ⊂⊙i; ) )⊙{} ) : ∧( - ⊙⊙[]⊔ + ⊙⊙[]°□ ∧( ⊙⊙[] ∧( ⊙(↙2.) - ≡\-◫2[⊃(∘|↧↥⊙:⊙⊙∘|↥⊙↧⊙⊙⋅∘|⋅∘)]∩⍘⊟∩\+ + ≡\-◫2[⊃(∘|↧↥⊙:⊙⊙∘|↥⊙↧⊙⊙⋅∘|⋅∘)]∩°⊟∩\+ ⊃(⋅∘|Prune⊂⊏0_2⊙⋅∘|Prune⊂¤⍜⊢+⊡1⊙(⊡2)⊙⊙⋅∘) ): ; diff --git a/day06.ua b/day06.ua index 2e7b376..1921a5c 100644 --- a/day06.ua +++ b/day06.ua @@ -2,11 +2,11 @@ $ Time: 7 15 30 $ Distance: 9 40 200 TestInput ← -Quadratic ← ⊃+-⊃(⍜⍘√+|∘)⊃(¯÷×2|¯÷⊙⋅∘) +Quadratic ← ⊃+-⊃(⍜°√+|∘)⊃(¯÷×2|¯÷⊙⋅∘) Solve ← -1-:⊓⌈⌊ Quadratic ¯1 ⊙¯ -PartI ← /× Solve ≡⍘⊟ ⍉⊜(⊜parse≠@ .↘9)≠@\n. -PartII ← Solve ⍘⊟ ⍉⊜(parse▽≠@ .↘9)≠@\n. +PartI ← /× Solve ≡°⊟ ⍉⊜(⊜⋕≠@ .↘9)≠@\n. +PartII ← Solve °⊟ ⍉⊜(⋕▽≠@ .↘9)≠@\n. PartI TestInput PartII TestInput