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 way, given the native pipe operator, which is wonderful for newbies.
> @a = 1..100
> @a ==> map( { .sqrt } )
> @a ==> HYPER( { .sqrt } ) # faster map
Even it is being *too verbose*, is good enough for the first moment to a data scientist.

So I'm trying to decide the best way to abstract columns.
First, I decide to use a hash where the key is the column name and the value is the oriented list ou array.

> my %a = {'column1' => [1...5], 'column2' => ['a'...'e']}
Potential difficulties:
    Useless use of hash composer on right side of hash assignment; did you mean := instead?
    at line 2
    ------> <BOL>⏏<EOL>
{column1 => [1 2 3 4 5], column2 => [a b c d e]}

It is a warning, not an error!

But let's obey the warning.
> my %a = {'column1' := [1...5], 'column2' := ['a'...'e']}
===SORRY!=== Error while compiling:
Cannot use bind operator with this left-hand side
------> n1' := [1...5], 'column2' := ['a'...'e']⏏}

':=' in the error is meant to replace the assignment so you are binding directly to the hash.
So write,

my %a := {'column1' => [1...5], 'column2' => ['a'...'e']}

Without the binding you could write instead

my %a = 'column1' => [1...5], 'column2' => ['a'...'e']

See also https://docs.raku.org/type/Hash and https://docs.raku.org/routine/:=


Now we got an error.

Someone may explain me why I got this error??

Thanks in advance




--
Aureliano Guedes
skype: aureliano.guedes
contato:  (11) 94292-6110
whatsapp +5511942926110

Reply via email to