On 2020-01-15 21:43, Aureliano Guedes wrote:
Thanks ToddAndMargo
Perhaps I have some questions to help improve the docs (I think):
1- You told about arrays of hashes, in Perl5 the opposite (hashes of
arrays) is quite fuzzy. Then, in Raku, how do I deal with hashes of arrays?
2 - "[...]say %h<a b>:p; # note: no comma between the a and the
b[...]", that is interesting because using comma or semi-coma I had
different behavior.
perl6 -e 'my %h = a => "x", b=>"r", c=>"z"; say %h<a c>:p'
perl6 -e 'my %h = a => "x", b=>"r", c=>"z"; say %h<a, c>:p'
perl6 -e 'my %h = a => "x", b=>"r", c=>"z"; say %h<a; c>:p'
Sure, you notice I used "perl6" instead "raku". I'm not updated.
Hi Aureliano,
Hmmm. Interesting. Never used hashes of arrays. I am
at a loss.
What would be the usage?
Tip: at the command line, enter "perl6" by itself.
It will open up what is called REPL. It is like a
scratch pad to test code. Your code looks like this
in REPL.
$ raku
To exit type 'exit' or '^D'
> my %h = a => "x", b=>"r", c=>"z"; say %h<a c>:p
(a => x c => z)
> my %h = a => "x", b=>"r", c=>"z"; say %h<a, c>:p
(c => z)
> my %h = a => "x", b=>"r", c=>"z"; say %h<a; c>:p
(c => z)
>
Currently it borks on constrained values (my int32 $x).
It has an open bug on it:
$ raku
To exit type 'exit' or '^D'
> my int32 $x;
0
> say $x
Bytecode validation error at offset 148, instruction 23:
operand type 32 does not match register type 24 for op getlex_ni in
frame <unit>
One of the guys on the group told me about REPL and I
LOVE IT!
-T
On my system (Fedora 31):
$ raku -v
This is Rakudo version 2019.07.1 built on MoarVM version
2019.07.1 implementing Perl 6.d.
$ rpm -qa rakudo*
rakudo-pkg-2019.07.1-03.x86_64
$ alias p6
alias p6='perl6 -e'
$ which raku
/usr/bin/raku
$ which perl6
/usr/bin/perl6
$ ls -al /usr/bin/raku
lrwxrwxrwx. 1 root root 25 Dec 25 14:36 /usr/bin/raku ->
/opt/rakudo-pkg/bin/perl6
$ ls -al /usr/bin/perl6
lrwxrwxrwx. 1 root root 25 Nov 3 14:53 /usr/bin/perl6 ->
/opt/rakudo-pkg/bin/perl6