Re: stashing an array in a hash and yanking it back out

2020-03-04 Thread Elizabeth Mattijsen
FWIW, it's the same as if you would do:

my @a = ^10;
my $b = @a;
dd $b;  # Array $b = $[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

A scalar can only hold a single value.  That single value in $b is an Array.  
But it is still a single value (shown in the output by the $[ ] construct.  
Adding .list of circumfixing it with @( ) makes it a "real" iterable thing 
again:

dd $b.list;  # Array @a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
dd @($b);# Array @a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

With regards to slipping, you can actually do this when assigning to the hash 
already, which is handy if you need to iterate more than once over the value 
for that key:

my @a = ^10;
my %h = a => @a;
.say for %h;
[0 1 2 3 4 5 6 7 8 9]

my @a = ^10;
my %h = a => |@a;
.say for %h;
0
1
2
etc.

> On 5 Mar 2020, at 04:36, Joseph Brenner  wrote:
> 
> There might not be much to say about this, I just though I'd
> mention that I keep getting re-surprised by basics with Raku,
> like this one, where first I stash an array away in a hash and
> later try to pull the array out again:
> 
>my %stash;
>my @monsters =
>  << godzilla grendel wormface blob fingfangfoom tingler >>;
>%stash{'monsters'} = @monsters;
> 
> Now some time later, when I wanted to extract that array again,
> my first thought was to do this:
> 
>my @m = %stash{'monsters'};
> 
> But that doesn't get the original array back, instead you end up
> with the entire original array as the first element of a newly
> created array:
> 
># [[godzilla grendel wormface blob fingfangfoom tingler]]
> 
> Yary Hluchan pointed out that I could slip it out, and get what
> I wanted:
> 
>my @m = | %stash{'monsters'};
>say @m;
># [godzilla grendel wormface blob fingfangfoom tingler]
> 
> Though for what I'm doing now, I think it might be better to
> just alias it with the binding operator:
> 
>   my @m := %stash{'monsters'};
> 
> So, like I said: I don't have any particular questions about this,
> I think I more or less know what's going on... it will be a while
> before I stop tripping over this sort of thing, though.


stashing an array in a hash and yanking it back out

2020-03-04 Thread Joseph Brenner
There might not be much to say about this, I just though I'd
mention that I keep getting re-surprised by basics with Raku,
like this one, where first I stash an array away in a hash and
later try to pull the array out again:

my %stash;
my @monsters =
  << godzilla grendel wormface blob fingfangfoom tingler >>;
%stash{'monsters'} = @monsters;

Now some time later, when I wanted to extract that array again,
my first thought was to do this:

my @m = %stash{'monsters'};

But that doesn't get the original array back, instead you end up
with the entire original array as the first element of a newly
created array:

# [[godzilla grendel wormface blob fingfangfoom tingler]]

Yary Hluchan pointed out that I could slip it out, and get what
I wanted:

my @m = | %stash{'monsters'};
say @m;
# [godzilla grendel wormface blob fingfangfoom tingler]

Though for what I'm doing now, I think it might be better to
just alias it with the binding operator:

   my @m := %stash{'monsters'};

So, like I said: I don't have any particular questions about this,
I think I more or less know what's going on... it will be a while
before I stop tripping over this sort of thing, though.


Re: Rakudo Star v2020.01

2020-03-04 Thread Parrot Raiser
> I have no plans currently to go through the existing infrastructure and
> rename things. I'm not intimately familiar with the code in Rakudo
> Star, and prefer to not touch what isn't broken.

That sounds like a sensible decision. After thinking about the job, I
realise that it's going to take careful untangling, locating every
reference to files before renaming them.

On 3/3/20, Patrick Spek  wrote:
> On Tue, 3 Mar 2020 16:41:47 -0500
> Parrot Raiser <1parr...@gmail.com> wrote:
>
>> I've managed to download 2020.01, and run it with an explicit path,
>> but the directory structure that my script used to follow, is broken
>> in some way.  (I'll investigate further, to see if I can spot the
>> change, but a required directory tree might help me find it, if you
>> could provide one.)
>>
>> A fair number of references to "perl6" remain in the directories. How
>> many references have to be untangled before it is consistently
>> "rakudo"?
>
> I have no plans currently to go through the existing infrastructure and
> rename things. I'm not intimately familiar with the code in Rakudo
> Star, and prefer to not touch what isn't broken. If references are
> found and can be easily fixed, I'll gladly look into it, though. Of
> course, patches to help out are much appreciated as well!
>
> Also, please note that the language is called Raku, the compiler is
> Rakudo.
>
> --
> With kind regards,
>
> Patrick Spek
>
>
> www:  https://www.tyil.nl/
> mail: p.s...@tyil.nl
> pgp:  1660 F6A2 DFA7 5347 322A  4DC0 7A6A C285 E2D9 8827
>
> social: https://soc.fglt.nl/tyil
> git:https://gitlab.com/tyil/
>