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:
6140b05
)
07a trivial CLI that can cd
author
Ben Harris
<bjh21@bjh21.me.uk>
Tue, 7 May 2024 08:14:37 +0000
(09:14 +0100)
committer
Ben Harris
<bjh21@bjh21.me.uk>
Tue, 7 May 2024 08:22:19 +0000
(09:22 +0100)
07/07a.bqn
[new file with mode: 0644]
patch
|
blob
diff --git a/07/07a.bqn
b/07/07a.bqn
new file mode 100644
(file)
index 0000000..
7d09dca
--- /dev/null
+++ b/
07/07a.bqn
@@ -0,0
+1,16
@@
+Split←{
+ blocknums ← +`𝕨
+ # Set entries in blocknums to -1 when they correspond with delimiters.
+ blocknums ↩ (¯1¨)⌾(𝕨⊸/) blocknums
+ blocknums⊔𝕩
+}
+
+FS←{𝕤
+ cwd←⟨⟩
+ Exec⇐{
+ 𝕊⟨"cd", "/"⟩: cwd↩⟨⟩;
+ 𝕊⟨"cd", ".."⟩: cwd 1⊸↓↩;
+ 𝕊⟨"cd", dir⟩: cwd ⟨dir⟩⊸∾↩
+ }
+ Cmd⇐{Exec (' '=𝕩)Split𝕩}
+}