Re: unflattering flat

2020-04-22 Thread William Michels via perl6-users
Regarding a recent discussion on flattening hash values. Here are some posted answers: >#Konrad Bucheli > my %hash-with-arrays = a => [1,2], b => [2,3]; {a => [1 2], b => [2 3]} > %hash-with-arrays.values>>.map({$_}) #makes a List ((1 2) (2 3)) > %hash-with-arrays.values>>.map({$_}).flat (2 3 1

Re: unflattering flat

2020-04-07 Thread yary
I left out first line in the example REPL > my %hash-with-arrays = a => [1,2], b => [3,4], c=>5, d=>[6,[7,8]] {a => [1 2], b => [3 4], c => 5, d => [6 [7 8]]} > say gather %hash-with-arrays.values.deepmap: { .take } (6 7 8 1 2 3 4 5) > say %hash-with-arrays.values>>[].flat (6 [7 8] 1 2 3 4 5)

Re: unflattering flat

2020-04-07 Thread yary
Larry all looks good with the latest email and encoding! Interpreting %hash-with-arrays.values>>[].flat aka %hash-with-arrays.values»[].flat >> is hyperoperator https://docs.raku.org/language/operators#index-entry-hyper_ <<-hyper_>>-hyper_«-hyper_»-Hyper_operators and as for [] "it's the

Re: unflattering flat

2020-04-07 Thread Larry Wall
On Tue, Apr 07, 2020 at 09:15:06AM -0700, Larry Wall wrote: : Maybe if I actually put a Chinese character in like 楽 it will leave it in UTF-8? Oops, actually, now that I think about it, 楽 (raku) is a Japanese-only character. The Chinese equivalents are traditional 樂 and simplified 乐. I really

Re: unflattering flat

2020-04-07 Thread Larry Wall
On Mon, Apr 06, 2020 at 08:04:45PM -0400, yary wrote: : Larry's answer came through my browser with munged Unicode, it looks like : this : : [image: image.png] : - with the Chinese character for "garlic" after the word "values" I wrote the Unicode equivalent of:

Re: unflattering flat

2020-04-06 Thread Brad Gilbert
[*] is also a meta prefix op say [*] 4, 3, 2; # 24 But it also looks exactly the same as the [*] postfix combination of operators my @a = 1,2,3; say @a[*]; # (1 2 3) There is supposed to be one that looks like [**] my @b = [1,], [1,2], [1,2,3]; say @b[**]; # (1 1 2 1 2

Re: unflattering flat

2020-04-06 Thread yary
Question- what am I missing from the below two replies? Larry's answer came through my browser with munged Unicode, it looks like this [image: image.png] - with the Chinese character for "garlic" after the word "values" Then Ralph says "[**] will be a wonderful thing when it's implemented" but

Re: unflattering flat

2020-04-04 Thread Larry Wall
Oh, you wanna go deep? Why stop at 10 levels? say gather %hash-with-arrays.values.deepmap: { .take } No .flat needed, even. Larry On Sat, Apr 04, 2020 at 10:59:36PM +0100, Ralph Mellor wrote: : [**] will be a wonderful thing when it's implemented. : : In the meantime, you could maybe use

Re: unflattering flat

2020-04-04 Thread Ralph Mellor
A microwave is easier: https://www.google.com/search?q=microwave+garlic+to+remove+skin [**] will be a wonderful thing when it's implemented. In the meantime, you could maybe use this as a hack that works to 10 levels deep: my %hash-with-arrays = a => [1,2], b => [3,4]; sub postfix:<[**]> ($arg)

Re: unflattering flat

2020-04-04 Thread Larry Wall
You can also do a hyper descalarize if you're into that sort of thing: %hash-with-arrays.values»[].flat Larry

Re: unflattering flat

2020-04-04 Thread Elizabeth Mattijsen
> On 2 Apr 2020, at 23:49, Konrad Bucheli via perl6-users > wrote: > I have a hash with arrays as value. Out of that I wanted to get a flat list > with all the entries in the value arrays. My first intuitive attempt was to > use flat, but somehow that only works with an additional map step: >

unflattering flat

2020-04-03 Thread Konrad Bucheli via perl6-users
Dear Raku programmers I have a hash with arrays as value. Out of that I wanted to get a flat list with all the entries in the value arrays. My first intuitive attempt was to use flat, but somehow that only works with an additional map step: $ raku To exit type 'exit' or '^D' > my