chiark
/
gitweb
/
~bjharris
/
aoc-2022.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f296015
)
15a: input parsing
author
Ben Harris
<bjh21@bjh21.me.uk>
Wed, 15 May 2024 10:34:46 +0000
(11:34 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Wed, 15 May 2024 10:34:46 +0000
(11:34 +0100)
15/15a.bqn
[new file with mode: 0644]
patch
|
blob
diff --git a/15/15a.bqn
b/15/15a.bqn
new file mode 100644
(file)
index 0000000..
b794dfe
--- /dev/null
+++ b/
15/15a.bqn
@@ -0,0
+1,15
@@
+Split←{
+ blocknums ← +`𝕨
+ # Set entries in blocknums to -1 when they correspond with delimiters.
+ blocknums ↩ (¯1¨)⌾(𝕨⊸/) blocknums
+ blocknums⊔𝕩
+}
+
+Prep←{
+ words←' '⊸=⊸Split 𝕩
+ ⟨sx,sy,bx⟩←2↓¨¯1↓¨⟨2,3,8⟩⊏words
+ by←2↓9⊑words
+ •ParseFloat¨⟨sx,sy,bx,by⟩
+}
+
+•Show Prep¨ •file.Lines ⊑•args