chiark / gitweb /
07a: got a list of files with full paths
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 7 May 2024 12:36:44 +0000 (13:36 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 7 May 2024 12:36:44 +0000 (13:36 +0100)
07/07a.bqn

index 7d09dca7b2a5b15669904bc53766ac8bd7dc535c..025e2cf3a7c95807d4c838d3ee45fcc7aee532af 100644 (file)
@@ -5,12 +5,25 @@ Split←{
   blocknums⊔𝕩
 }
 
+Prep←{
+  1↓(+`{"$ "≡2↑𝕩}¨𝕩)⊔𝕩
+}
+
 FS←{𝕤
   cwd←⟨⟩
+  nothing←⟨0,2⟩⥊⟨⟩ # 0 by 23 array, to return from "cd"
   Exec⇐{
-    𝕊⟨"cd", "/"⟩:  cwd↩⟨⟩;
-    𝕊⟨"cd", ".."⟩: cwd 1⊸↓↩;
-    𝕊⟨"cd", dir⟩:  cwd ⟨dir⟩⊸∾↩
+    ⟨⟩𝕊⟨"cd", "/"⟩:  cwd↩⟨⟩,       nothing;
+    ⟨⟩𝕊⟨"cd", ".."⟩: cwd 1⊸↓↩,     nothing;
+    ⟨⟩𝕊⟨"cd", dir⟩:  cwd ⟨dir⟩⊸∾↩, nothing;
+    input𝕊⟨"ls"⟩: >{𝕊⟨size,name⟩:⟨size,⟨name⟩∾cwd⟩}∘{(' '=𝕩)Split𝕩}¨input
   }
-  Cmd⇐{Exec (' '=𝕩)Split𝕩}
+  Cmd⇐{𝕨 Exec 1↓(' '=𝕩)Split𝕩}
 }
+
+Main←{
+  dev←FS @
+  files←∾{(1↓𝕩)dev.Cmd(⊑𝕩)}¨𝕩
+}
+
+•Show Main Prep •file.Lines ⊑•args