chiark / gitweb /
07: slight cleanups though I'm still not happy
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 7 May 2024 21:26:37 +0000 (22:26 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 7 May 2024 21:26:37 +0000 (22:26 +0100)
07/07a.bqn
07/07b.bqn

index f445839c17c82e86e5b8727e6fea1769555f48c1..98706c7ea5b6ab3f7569842559b95f3c52144e5f 100644 (file)
@@ -11,7 +11,7 @@ Prep←{
 
 FS←{𝕤
   cwd←⟨⟩
-  nothing←⟨0,2⟩⥊⟨⟩ # 0 by 23 array, to return from "cd"
+  nothing←⟨0,2⟩⥊⟨⟩ # 0 by 2 array, to return from "cd"
   Exec⇐{
     ⟨⟩𝕊⟨"cd", "/"⟩:  cwd↩⟨⟩,       nothing;
     ⟨⟩𝕊⟨"cd", ".."⟩: cwd ¯1⊸↓↩,    nothing;
@@ -23,13 +23,13 @@ FS←{𝕤
 
 Main←{
   dev←FS @
-  files←∾{(1↓𝕩)dev.Cmd(⊑𝕩)}¨𝕩
-  dirs ←⍷({"dir"≡⊑𝕩}˘files)/files
-  dirs â\86©Â¯1â\8a\8fâ\8d\89dirs
-  filesâ\86©â\8d·({"dir"â\89¢â\8a\91ð\9d\95©}Ë\98files)/files
-  [sizes,filepaths]←⍉files
-  sizes •ParseFloat¨↩
-  DirSize←{𝕊dir:+´({∨´dir⊸≡¨↑𝕩}¨filepaths)/sizes}
+  [sizes,paths]←⍉⍷∾{(1↓𝕩)dev.Cmd(⊑𝕩)}¨𝕩
+  isdir←"dir"⊸≡¨sizes
+  dirs â\86\90isdir/paths
+  filesâ\86\90(¬isdir)/paths
+  sizes↩•ParseFloat¨(¬isdir)/sizes
+  files↩({"dir"≢⊑𝕩}˘files)/files
+  DirSize←{𝕊dir:+´({∨´dir⊸≡¨↑𝕩}¨files)/sizes}
   +´ {100000≥𝕩}⊸/ DirSize¨dirs
 }
 
index 439c96858418c25784fc9e50af63a0cc15ae1b1f..ec8cd4d2456fcfe8d264a099b37b05e186308aa0 100644 (file)
@@ -11,7 +11,7 @@ Prep←{
 
 FS←{𝕤
   cwd←⟨⟩
-  nothing←⟨0,2⟩⥊⟨⟩ # 0 by 23 array, to return from "cd"
+  nothing←⟨0,2⟩⥊⟨⟩ # 0 by 2 array, to return from "cd"
   Exec⇐{
     ⟨⟩𝕊⟨"cd", "/"⟩:  cwd↩⟨⟩,       nothing;
     ⟨⟩𝕊⟨"cd", ".."⟩: cwd ¯1⊸↓↩,    nothing;
@@ -23,13 +23,13 @@ FS←{𝕤
 
 Main←{
   dev←FS @
-  files←∾{(1↓𝕩)dev.Cmd(⊑𝕩)}¨𝕩
-  dirs ←⍷({"dir"≡⊑𝕩}˘files)/files
-  dirs â\86©Â¯1â\8a\8fâ\8d\89dirs
-  filesâ\86©â\8d·({"dir"â\89¢â\8a\91ð\9d\95©}Ë\98files)/files
-  [sizes,filepaths]←⍉files
-  sizes •ParseFloat¨↩
-  DirSize←{𝕊dir:+´({∨´dir⊸≡¨↑𝕩}¨filepaths)/sizes}
+  [sizes,paths]←⍉⍷∾{(1↓𝕩)dev.Cmd(⊑𝕩)}¨𝕩
+  isdir←"dir"⊸≡¨sizes
+  dirs â\86\90isdir/paths
+  filesâ\86\90(¬isdir)/paths
+  sizes↩•ParseFloat¨(¬isdir)/sizes
+  files↩({"dir"≢⊑𝕩}˘files)/files
+  DirSize←{𝕊dir:+´({∨´dir⊸≡¨↑𝕩}¨files)/sizes}
   free←70000000-DirSize⟨⟩
   need←30000000-free
   ⌊´{need≤𝕩}⊸/DirSize¨dirs