Yes you're right: I could've sworn I tried that in the repl a minute
ago and it worked, but actually it's a no-op and appends nothing to
the hash.
This is okay, doing it the other way (without the inner parens around
the colonpair) is not:
ny %stash;
my @monsters = << godzilla grendel wormface bl
Joseph, you've got yourself into a trap I fell into yesterday. %stash.append(
:@stuff ) syntax is about calling append method with a named parameter stuff
whereas append works with positionals only. So, your case should be written:
%stash.append( (:@stuff) );
Which is apparently more cumbersom
> Though I've no idea what those colons are/are not doing.
Those are "colon pairs" (which I've relearned around three times now...):
https://docs.raku.org/language/glossary#index-entry-Colon_Pair
Except for this colon:
%stash.append: (rocks => @rocks);
Which is a short hand for this:
%
Thanks, this is indeed the trick:
> Ok, clear enough. This is as simple as:
> %stash.append: (:@greek);
On 3/17/20, Vadim Belman wrote:
> My reply to Joseph went off the list too. I copy it over here. Here is the
> key quote from Joseph's email I was answering to:
>
> So doing that with appen
Vadim seems to have provided the definitive answer:
Ok, clear enough. This is as simple as:
> %stash.append: (:@greek);
Sorry, I thought I was replying on list...
I was trying to remind that what William Michels was asking about was
a way to assign an array to a hash field named after the array, but
without manually typing the name twice.
These both work, but aren't what he was asking about:
%stash{'greek'}
My reply to Joseph went off the list too. I copy it over here. Here is the key
quote from Joseph's email I was answering to:
So doing that with append would be like this:
%stash.append: (:greek(@greek));
William Michels was wondering if there was a way to avoid
repeating the name twice, specul