diff options
Diffstat (limited to 'challenge-112')
127 files changed, 4841 insertions, 577 deletions
diff --git a/challenge-112/aaronreidsmith/blog.txt b/challenge-112/aaronreidsmith/blog.txt new file mode 100644 index 0000000000..3a9b06e61b --- /dev/null +++ b/challenge-112/aaronreidsmith/blog.txt @@ -0,0 +1 @@ +https://aaronreidsmith.github.io/blog/perl-weekly-challenge-112/ diff --git a/challenge-112/aaronreidsmith/raku/ch-1.raku b/challenge-112/aaronreidsmith/raku/ch-1.raku new file mode 100644 index 0000000000..748081b826 --- /dev/null +++ b/challenge-112/aaronreidsmith/raku/ch-1.raku @@ -0,0 +1,43 @@ +#!/usr/bin/env raku + +sub challenge(Str $path is copy) returns Str { + die "Must be an absolute path" unless $path.starts-with('/'); + + $path = $path.substr(1); + $path = $path.subst(/\/ ** 2..*/, '/', :global); + $path = $path.substr(0, *-1) if $path.ends-with('/'); + + my @output; + for $path.split('/') -> $dir { + given $dir { + when '.' { Nil } + when '..' { + die "Illegal path" if @output.elems == 0; + @output.pop; |
