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

Notes/Questions about Leon Timmermans's talk

Thread Next
From:
Marc Chantreux
Date:
June 9, 2021 11:04
Subject:
Notes/Questions about Leon Timmermans's talk
Message ID:
YMCckeCKh4wt/mX4@prometheus.u-strasbg.fr
hello,

I just saw this and it's very good

https://www.youtube.com/watch?v=elalwvfmYgk

The features he picked are indeed things i really like in raku
and i learned some interesting details. Other details are still
bugging me so i have some questions there:

A. if x -> $y with //

For exemple, given a function Foo

    sub foo ( Int $x ) { 42 if $x > 5  }

this is awesome you can write

    if foo 7 -> $value { say $value }

and even

    if foo 7 { say $^value }

but is there a way (adverb?) to match if something is False but defined
so given this

    sub foo ( Int $x ) { 0 if $x > 5 }

i would write something else than

    sub foo ( Int $x ) { 0 if $x > 5 }
    sub hello {say "hello $^world"}
    if defined my $value = foo 45 { hello $value }

B. » vs map

Leon made this slide where i consider as equivalent

    @list».abs
    @list.map(*.abs)

someone, some day, told me they are not and i shouldn't use » if
i don't know what it means. I read the doc and came to the
(incorrect?) conclusion that

    @list».abs

is actually

    @list.map(*.abs).hyper

which could have important overloads while creating an HyperSeq.

should i reconsider the whole thing and use » without fear?

regards,
marc


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About