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 <m...@unistra.fr> 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

Reply via email to