chiark / gitweb /
13b done
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 13 May 2024 20:03:39 +0000 (21:03 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Mon, 13 May 2024 20:03:39 +0000 (21:03 +0100)
13/13b.bqn [new file with mode: 0644]

diff --git a/13/13b.bqn b/13/13b.bqn
new file mode 100644 (file)
index 0000000..9fa7daa
--- /dev/null
@@ -0,0 +1,24 @@
+Split←{
+  blocknums ← +`𝕨
+  # Set entries in blocknums to -1 when they correspond with delimiters.
+  blocknums ↩ (¯1¨)⌾(𝕨⊸/) blocknums
+  blocknums⊔𝕩
+}
+
+Prep←{
+  ParseVal¨(""⊸≢¨𝕩)/𝕩
+}
+
+ParseList←{𝕊in:
+  in↩1↓¯1↓in
+  depth←+`('['=in)-(']'=in)
+  ParseVal¨ ((','=in)∧(depth=0)) Split in
+}
+
+ParseVal←{'['=⊑𝕩}◶⟨•ParseFloat,ParseList⟩
+
+Main←{
+  ×´(⟨⟨⟨2⟩⟩,⟨⟨6⟩⟩⟩∊˜∧𝕩∾⟨⟨⟨2⟩⟩,⟨⟨6⟩⟩⟩)/1+↕2+≠𝕩
+}
+
+•Show Main Prep •file.Lines ⊑•args