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:
9cb929a
)
10a done
author
Ben Harris
<bjh21@bjh21.me.uk>
Fri, 10 May 2024 08:10:18 +0000
(09:10 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Fri, 10 May 2024 08:10:18 +0000
(09:10 +0100)
10/10a.bqn
[new file with mode: 0644]
patch
|
blob
diff --git a/10/10a.bqn
b/10/10a.bqn
new file mode 100644
(file)
index 0000000..
7df5b70
--- /dev/null
+++ b/
10/10a.bqn
@@ -0,0
+1,20
@@
+Split←{
+ blocknums ← +`𝕨
+ # Set entries in blocknums to -1 when they correspond with delimiters.
+ blocknums ↩ (¯1¨)⌾(𝕨⊸/) blocknums
+ blocknums⊔𝕩
+}
+
+Insn←{
+ 𝕊⟨"noop"⟩:⟨0⟩;
+ 𝕊⟨"addx",v⟩:⟨0,•ParseFloat v⟩
+}
+Prep←{Insn(' '⊸=⊸Split 𝕩)}
+
+Main←{
+ cn←1+↕⊑≢𝕩
+ xs←1+`𝕩
+ +´cn×xs×20=40|cn
+}
+
+•Show Main »∾Prep¨ •file.Lines ⊑•args