Re: pint: Elizabeth, sort list???

[email protected] (Fernando Santagata)
Newsgroups perl.perl6.users
Message-ID <CAJ+jyGhFAOdkiCgPmFi=-i4T_7UrgmQgv_+Cq--DGikVb9tqBA@mail.gmail.com>
Hi Marc,

This works:

<afoo12 afoo2> ==> sort({ | map { +$_ // $_ }, .split: /\d+/, :v }) ==>
say()

As the documentation says here https://docs.raku.org/routine/%3D%3D%26gt%3B

The precedence is very loose so you will need to use parentheses to assign
the result



On Thu, Mar 7, 2024 at 8:37 AM Marc Chantreux <[email protected]> wrote:

> hello,
>
> > How would you write that expression using the feed operator?
>
> I tried
>
>         < afoo12 afoo2 >
>         ==> {.sort: { | map { +$_ // $_ }, .split: /\d+/, :v }}
>         ==> {map &say}
>
> and the error message is really interesting
>
>         Only routine calls or variables that can '.append' may
>         appear on either side of feed operators.
>
> on the other hand: I really don't understand why ==> even exists
> as method call syntax works well.
>
>         < afoo12 afoo2 >
>         .sort( { | map { +$_ // $_ }, .split: /\d+/, :v } )
>         .map(&say)
>
> what I would love instead is something closer than the haskell's $
> operator with a very low priority so it could be possible to be
> parenthesis free.
>
> as example. I would like
>
>         1..10 ==> map * * 2 ==> say
>
> to be a joyful version of
>
>         (1..10).map(* * 2).say
>
> regards
>
> --
> Marc Chantreux
> Pôle CESAR (Calcul et services avancés à la recherche)
> Université de Strasbourg
> 14 rue René Descartes,
> BP 80010, 67084 STRASBOURG CEDEX
> 03.68.85.60.79
>
>

-- 
Fernando Santagata
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.