From 0d06f4df8f601d34159d61718c6b2451d28d593d Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 4 May 2024 09:49:13 +0100 Subject: [PATCH] Genericise Split to modifier _split in 04 --- 04/04a.bqn | 6 +++--- 04/04b.bqn | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/04/04a.bqn b/04/04a.bqn index 5f24985..4e378b4 100644 --- a/04/04a.bqn +++ b/04/04a.bqn @@ -1,12 +1,12 @@ -Split←{ - delims←𝕩∊",-" +_split←{ + delims←𝔽𝕩 blocknums ← +`delims # Set entries in blocknums to -1 when they correspond with delims. blocknums ↩ (¯1¨)⌾(delims⊸/) blocknums blocknums⊔𝕩 } -Prep←{⍉>•ParseFloat¨¨Split¨𝕩} +Prep←{⍉>•ParseFloat¨¨{𝕩∊",-"}_split¨𝕩} Main←{𝕊[x0,x1,y0,y1]: +´((x0≤y0)∧(x1≥y1))∨((y0≤x0)∧(y1≥x1)) diff --git a/04/04b.bqn b/04/04b.bqn index 8832e63..048a6dc 100644 --- a/04/04b.bqn +++ b/04/04b.bqn @@ -1,12 +1,12 @@ -Split←{ - delims←𝕩∊",-" +_split←{ + delims←𝔽𝕩 blocknums ← +`delims # Set entries in blocknums to -1 when they correspond with delims. blocknums ↩ (¯1¨)⌾(delims⊸/) blocknums blocknums⊔𝕩 } -Prep←{⍉>•ParseFloat¨¨Split¨𝕩} +Prep←{⍉>•ParseFloat¨¨{𝕩∊",-"}_split¨𝕩} Main←{𝕊[x0,x1,y0,y1]: +´((x0≤y1)∧(x1≥y0))∨((y0≤x1)∧(y1≥x0)) -- 2.30.2