aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-05-25 10:03:21 +0100
committerGitHub <noreply@github.com>2025-05-25 10:03:21 +0100
commit995e185aa455248b2852b63cd36c15e815de8fb5 (patch)
tree29a1845d921a18de5e4591673ed9b752142260e0
parent0ab31bd5fe6c07040d84ac6bc877d16aa762bf06 (diff)
parent52daed36f2fa8db556444d3044d2975975d94ca9 (diff)
downloadperlweeklychallenge-club-995e185aa455248b2852b63cd36c15e815de8fb5.tar.gz
perlweeklychallenge-club-995e185aa455248b2852b63cd36c15e815de8fb5.tar.bz2
perlweeklychallenge-club-995e185aa455248b2852b63cd36c15e815de8fb5.zip
Merge pull request #12072 from memark/memark/321-322
Add Uiua solutions for 321, 322
-rw-r--r--challenge-321/memark/uiua/ch-1.ua14
-rw-r--r--challenge-321/memark/uiua/ch-2.ua20
-rw-r--r--challenge-322/memark/uiua/ch-1.ua16
-rw-r--r--challenge-322/memark/uiua/ch-2.ua12
4 files changed, 62 insertions, 0 deletions
diff --git a/challenge-321/memark/uiua/ch-1.ua b/challenge-321/memark/uiua/ch-1.ua
new file mode 100644
index 0000000000..5966c10083
--- /dev/null
+++ b/challenge-321/memark/uiua/ch-1.ua
@@ -0,0 +1,14 @@
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-321/#TASK1
+
+# Uiua 0.17.0-dev.1
+
+DistinctAverage ← (
+ ⍜⊡₁⇌ ↯⊂2 ÷₂⊸⧻ ⍆
+ ⧻◴/(÷₂+)
+)
+
+┌─╴🧪
+ ⍤⤙≍ 1 DistinctAverage 1_2_4_3_5_6
+ ⍤⤙≍ 2 DistinctAverage 0_2_4_8_3_5
+ ⍤⤙≍ 2 DistinctAverage 7_3_1_0_5_9
+└─╴
diff --git a/challenge-321/memark/uiua/ch-2.ua b/challenge-321/memark/uiua/ch-2.ua
new file mode 100644
index 0000000000..5dd27fc3e3
--- /dev/null
+++ b/challenge-321/memark/uiua/ch-2.ua
@@ -0,0 +1,20 @@
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-321/#TASK2
+
+# Uiua 0.17.0-dev.1
+
+RemoveOneHash ← (
+ ≠∞⬚∞⊸⊗@#
+ ⍥(:⊸°⊏
+ ⊗@#
+ ⊂⊸-₁
+ ⍜⊏≡⋅[]
+ ⊏
+ )
+)
+BackspaceCompare ← ≍∩(⍥RemoveOneHash∞)
+
+┌─╴🧪
+ ⍤⤙≍ 1 BackspaceCompare "ab#c" "ad#c"
+ ⍤⤙≍ 1 BackspaceCompare "ab##" "a#b#"
+ ⍤⤙≍ 0 BackspaceCompare "a#b" "c"
+└─╴
diff --git a/challenge-322/memark/uiua/ch-1.ua b/challenge-322/memark/uiua/ch-1.ua
new file mode 100644
index 0000000000..9d3ec49e16
--- /dev/null
+++ b/challenge-322/memark/uiua/ch-1.ua
@@ -0,0 +1,16 @@
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-322/#TASK1
+
+# Uiua 0.17.0-dev.1
+
+StringFormat ← (
+ ▽⊸≠@-
+ ≡⇌⇌ ⬚@_↯⊂∞: ⇌
+ /$"_-_"
+ ▽⊸≠@_
+)
+
+┌─╴🧪
+ ⍤⤙≍ "ABC-DEF" StringFormat "ABC-D-E-F" 3
+ ⍤⤙≍ "A-BC-DE" StringFormat "A-BC-D-E" 2
+ ⍤⤙≍ "A-BCDE" StringFormat "-A-B-CD-E" 4
+└─╴
diff --git a/challenge-322/memark/uiua/ch-2.ua b/challenge-322/memark/uiua/ch-2.ua
new file mode 100644
index 0000000000..bc8466d867
--- /dev/null
+++ b/challenge-322/memark/uiua/ch-2.ua
@@ -0,0 +1,12 @@
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-322/#TASK2
+
+# Uiua 0.17.0-dev.1
+
+RankArray ← +₁˜⊗◴⊸⍆
+
+┌─╴🧪
+ ⍤⤙≍ 4_1_3_2 RankArray 55_22_44_33
+ ⍤⤙≍ 1_1_1 RankArray 10_10_10
+ ⍤⤙≍ 4_1_1_3_2 RankArray 5_1_1_4_3
+
+└─╴