> On 26 Sep 2015, at 14:26, Aristotle Pagaltzis <pagalt...@gmx.de> wrote:
> * Elizabeth Mattijsen <l...@dijkmat.nl> [2015-09-26 13:20]:
>> There is: you just need to itemize the hash, e.g. by prefixing it with $
>> 
>> $ 6 'my %h = a => 42, b => 666; my @a = $%h; dd @a'
>> Array @a = [{:a(42), :b(666)},]
>> 
>> This is the one argument rule at work.
> 
> Aha! Much better. Explicit. “Don’t subject %h to flattening.”
> 
> No need to combine two other unrelated rules to bend around invoking the
> undesired rule; just directly saying not to invoke it.
> 
> Now of course I must ask – is there an opposite also? I.e. when writing
> a list, is there a way I can say “do flatten this item?” Or put in other
> words, what goes in place of XXX in the following to make it real?
> 
>    $ 6 'my %h = a => 42, b => 666; dd $_ for %h,XXX'
>    Hash %h = {:a(42), :b(666)}
>    :a(42)
>    :b(666)

moritz++ already mentioned it:

$ 6 'my %h = a => 42, b => 666; dd $_ for |%h,|%h'
:a(42)
:b(666)
:a(42)
:b(666)

Prefix | is a short way to Slip something :-)



Liz

Reply via email to