Re: [naive] hash assingment

2021-07-14 Thread Brad Gilbert
Honestly I would advise against using ==> at the moment. For one thing it doesn't even work like it is intended. Each side of it is supposed to act like a separate process. There are also issues with the syntax that are LTA. The fact that you have to tell it the left side is actually a list is

Re: [naive] hash assingment

2021-07-14 Thread Patrick R. Michaud
On Wed, Jul 14, 2021 at 07:41:14PM +, Daniel Sockwell wrote: > (Also, you may already know this, but when the keys of your hash are > strings, you can write %a instead of %a{'column1'} ) A minor nit: this only works if the string keys don't contain whitespace. (The single angle bracket

Re: [naive] hash assingment

2021-07-14 Thread William Michels via perl6-users
Hi Aureliano! Backing up a bit (and since you're favoring an array data structure), we had a discussion on StackOverflow regarding implementing R's concept of "named vectors" in Raku. See: "Is there a convenient way to replicate R's concept of 'named vectors' in Raku, possibly using Mixins?"

Re: [naive] hash assingment

2021-07-14 Thread Aureliano Guedes
thank It is now more clear. And I like this notation |%a ==> map({.sqrt}); less is more sometimes On Wed, Jul 14, 2021 at 4:41 PM Daniel Sockwell wrote: > To expand slightly on what Clifton said, the reason that > > > %a = %a.map: { .sqrt }; > > # (1 1.4142135623730951 1.7320508075688772 2

Re: [naive] hash assingment

2021-07-14 Thread Daniel Sockwell
To expand slightly on what Clifton said, the reason that > %a = %a.map: { .sqrt }; > # (1 1.4142135623730951 1.7320508075688772 2 2.23606797749979) does what you mean but > %a{'column1'} ==> map( { .sqrt } ) > # (2.23606797749979) does not is that the method .map maps over *each item* in the

Re: [naive] hash assingment

2021-07-14 Thread Aureliano Guedes
Yes, it does help. So, to create a new pair *k*ey/*v*alue on the fly in a hash given another pair k/v, or even modify it will be a problem, then maybe will better use an array instead of a hash. > my @a = [ 1..5, 'a'..'e' ] [1..5 "a".."e"] > @a[2] = [@a[0][] ==> map( { .sqrt} )] > @a[2] [1

Re: [naive] hash assingment

2021-07-14 Thread Clifton Wood
Unfortunately, given this: my %a = 'column1' => [1...5], 'column2' => ['a'...'e'] > column1 and column2 cannot yet be referenced to create column3. You need to do that on another line: %a = %a.map: { .sqrt }; Which gives the following: > %a.gist.say # {column1 => [1 2 3 4 5], column2 => [a b

Re: [naive] hash assingment

2021-07-14 Thread Aureliano Guedes
Thanks JJ, Marcel, Matthew That's help me a lot to understand how Raku hashes work; Little bit complex compared to Perl5. But now I got another question given my %a = 'column1' => [1...5], 'column2' => ['a'...'e'] I want to calculate sqrt and store in column3 > %a{'column1'}.map({ .sqrt }) (1

Re: [naive] hash assingment

2021-07-14 Thread Marcel Timmerman
On 7/14/21 7:43 PM, Aureliano Guedes wrote: Hi all, Trying to knowing a little bit more about Raku lang, I decided to write a simple (as possible) lib to became similar to R/dplyr or Python/Pandas method to data wrangle. So, Raku gives us the possibility to deal with data in a functional 

Re: [naive] hash assingment

2021-07-14 Thread JJ Merelo
El mié, 14 jul 2021 a las 19:43, Aureliano Guedes (< guedes.aureli...@gmail.com>) escribió: > Hi all, > > Trying to knowing a little bit more about Raku lang, I decided to write a > simple (as possible) lib to became similar to R/dplyr or Python/Pandas > method to data wrangle. > > So, Raku gives

[naive] hash assingment

2021-07-14 Thread Aureliano Guedes
Hi all, Trying to knowing a little bit more about Raku lang, I decided to write a simple (as possible) lib to became similar to R/dplyr or Python/Pandas method to data wrangle. So, Raku gives us the possibility to deal with data in a functional way, given the native pipe operator, which is

REPL / Linenoise question (backslashes)

2021-07-14 Thread William Michels via perl6-users
Hi, I've recently updated my Rakudo installation, and I wanted to test multi-line input in the REPL. By mistake I entered a backslash at the REPL command line: user@mbook:$ raku Welcome to 퐑퐚퐤퐮퐝퐨™ v2021.06. Implementing the 퐑퐚퐤퐮™ programming language v6.d. Built on MoarVM version 2021.06. To