aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-321/memark/uiua/ch-1.ua14
-rw-r--r--challenge-321/memark/uiua/ch-2.ua20
2 files changed, 34 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"
+└─╴