From: Ben Harris Date: Tue, 7 May 2024 18:24:54 +0000 (+0100) Subject: 07a: store paths in the normal order (root to leaf) X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=3cc9e037505766c9fbfcc135c90f79201c861779;p=aoc-2022.git 07a: store paths in the normal order (root to leaf) --- diff --git a/07/07a.bqn b/07/07a.bqn index a22a0e4..0cd6fc8 100644 --- a/07/07a.bqn +++ b/07/07a.bqn @@ -14,9 +14,9 @@ FS←{𝕤 nothing←⟨0,2⟩⥊⟨⟩ # 0 by 23 array, to return from "cd" Exec⇐{ ⟨⟩𝕊⟨"cd", "/"⟩: cwd↩⟨⟩, nothing; - ⟨⟩𝕊⟨"cd", ".."⟩: cwd 1⊸↓↩, nothing; - ⟨⟩𝕊⟨"cd", dir⟩: cwd ⟨dir⟩⊸∾↩, nothing; - input𝕊⟨"ls"⟩: >{𝕊⟨size,name⟩:⟨size,⟨name⟩∾cwd⟩}∘{(' '=𝕩)Split𝕩}¨input + ⟨⟩𝕊⟨"cd", ".."⟩: cwd ¯1⊸↓↩, nothing; + ⟨⟩𝕊⟨"cd", dir⟩: cwd ∾⟜⟨dir⟩↩, nothing; + input𝕊⟨"ls"⟩: >{𝕊⟨size,name⟩:⟨size,cwd∾⟨name⟩⟩}∘{(' '=𝕩)Split𝕩}¨input } Cmd⇐{𝕨 Exec 1↓(' '=𝕩)Split𝕩} }