develooper Front page | perl.perl6.users | Postings from July 2021

[naive] hash assingment

Thread Next
Aureliano Guedes
July 14, 2021 17:43
[naive] hash assingment
Message ID:
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']⏏}

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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About