Documentation for method add assembled from the following pages:

Class: BagHash §

From BagHash

(BagHash) method add §

method add(BagHash: \to-add*%_ --> Nil)

When to-add is a single item, add inserts it into the BagHash or, if it was already present, increases its weight by 1. When to-add is a List, Array, Seq, or any other type that does the Iterator Role, add inserts each element of the Iterator into the SetHash or increments the weight of each element by 1.

Note: Added in version 2020.02.

Class: IO::Path §

From IO::Path

(IO::Path) method add §

Defined as:

method add(IO::Path:D: Str() $what --> IO::Path:D)

Concatenates a path fragment to the invocant and returns the resultant IO::Path. If adding ../ to paths that end with a file, you may need to call resolve for the resultant path to be accessible by other IO::Path methods like dir or open. See also sibling and parent.

"foo/bar".IO.mkdir;
"foo/bar".IO.add("meow")    .resolve.relative.say# OUTPUT: «foo/bar/meow␤» 
"foo/bar".IO.add("/meow")   .resolve.relative.say# OUTPUT: «foo/bar/meow␤» 
"foo/bar".IO.add("meow.txt").resolve.relative.say# OUTPUT: «foo/bar/meow.txt␤» 
"foo/bar".IO.add("../meow".resolve.relative.say# OUTPUT: «foo/meow␤» 
"foo/bar".IO.add("../../")  .resolve.relative.say# OUTPUT: «.␤»