Make directory path
There is a built-in function for this:
mkdir 'path/to/dir'
Alternatively, a custom solution (as per task description) that only uses the built-in mkdir
non-recursively. The "triangle reduce" meta-operator [\ ]
is used get the intermediate results of a left fold with the comma operator on the list of path elements.
for [\,] $*SPEC.splitdir("../path/to/dir") -> @path {
mkdir $_ unless .e given $*SPEC.catdir(@path).IO;
}