chiark / gitweb /
20a doesn't work
authorBen Harris <bjh21@bjh21.me.uk>
Wed, 29 May 2024 09:37:48 +0000 (10:37 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Wed, 29 May 2024 09:37:48 +0000 (10:37 +0100)
It's a pretty solution, but the problem statement has different ideas
about what moving an element past the end of the list means.

20/20a.bqn [new file with mode: 0644]

diff --git a/20/20a.bqn b/20/20a.bqn
new file mode 100644 (file)
index 0000000..897c8ce
--- /dev/null
@@ -0,0 +1,13 @@
+Prep←•ParseFloat¨
+
+Main←{ 𝕊 orig:
+  •Show orig
+  cur←orig
+  JumpFwd←{(1⊸⌽)⌾(((1+|𝕨)⊸↑)∘((⊑𝕩⊐𝕨)⊸⌽)) 𝕩}
+  Jump←{𝕨≥0 ? 𝕨 JumpFwd 𝕩; ⌽ 𝕨 JumpFwd ⌽𝕩}
+  {
+    •Show cur ↩ 𝕩 Jump cur
+  }¨orig
+}
+
+•Show Main Prep •file.Lines ⊑•args