From 282d6cdd8ff270d7105930d6129349879ae0be8d Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 13 May 2024 21:03:39 +0100 Subject: [PATCH] 13b done --- 13/13b.bqn | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 13/13b.bqn diff --git a/13/13b.bqn b/13/13b.bqn new file mode 100644 index 0000000..9fa7daa --- /dev/null +++ b/13/13b.bqn @@ -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 -- 2.30.2