Hi Marc, I did a search for 'semicolon' on the following page and
found the interesting text below. Semicolons are used to create
multidimensional lists, maybe that's what's going on in your code?

https://docs.perl6.org/language/list

"Lists of Lists can also be created by combining comma and semicolon.
This is also called multi-dimensional syntax, because it is most often
used to index multidimensional arrays."

"Unlike a comma, a hanging semicolon does not create a
multidimensional list in a literal. However, be aware that this
behavior changes in most argument lists, where the exact behavior
depends on the function... ."

"Because the semicolon doubles as a statement terminator it will end a
literal list when used at the top level, instead creating a statement
list. If you want to create a statement list inside parenthesis, use a
sigil before the parenthesis... ."

HTH, Bill.

PS I would presume some variation of 'next' would work where you're
using 'walkTheHash', but I don't really know for sure.

On Fri, Nov 22, 2019 at 5:45 AM Marc Chantreux <e...@phear.org> wrote:
>
> hello people,
>
> removing shell scripts is a good way to learn raku and compare.
> today i want to replace this:
>
>     fix () {
>         awk -F, '{print $1"     "$2}' |
>         sort -u                   |
>         awk -F" " '{
>             if   (seen == $1) print "\t"$2;
>             else { seen = $1; print $1 }
>         }'
>     }
>
> and i got this:
>
>     fix () perl6 -e '
>         my %section;
>         lines.map: {
>             my ($s,$ss) = .split(",");
>             %section{$s;$ss} = 1;
>         }
>         %section.keys.map:
>             { .say for $_ , |%section{$_}.keys.map: {"\t$_"} }
>     '
>
> ";" to walk in the hoh is really awesome but i don't know even know
> from where i know it and what's the object underneath.
> it isn't listed in the list of operators
> (https://docs.perl6.org/language/operators).
>
> i would like to know because it would be nice to make this block
>
>         my ($s,$ss) = .split(",");
>         %section{$s;$ss} = 1;
>
> a one liner so i'm searching for something like
>
>         %section{ .split(",").walkTheHash } = 1;
>
> any help will be warmly welcome.
>
> regards
> marc

Reply via email to