On Mon, Oct 12, 2020 at 10:03 AM Brian Duggan <bdug...@matatu.org> wrote:

> On Saturday, October 10, William Michels via perl6-users wrote:
> > I can point to the (functional) R-programming language to show what
> happens
> > there. When manipulating "array-like" (i.e. vector) objects in R, you can
> > do nested function calls, or sequential (piped) function calls, and still
> > get the same data structure out at the end. So a 10-element input gives a
> > 10-element output.
>
> This seems pretty convenient and intuitive.  At least, it is possible
> to mimic that behavior in Raku:
>
>         List.^find_method('split').wrap: { $^a.map: *.split($^b) }
>         List.^find_method('sin').wrap: *.map: *.sin;
>
This is like overwrite the function?
Might be better just implement a new function, I mean, a new verb as is
called in R.


>         my @words = <a,b c,d>;
>         my @nums = 0, π/2, 3 * π/2;
>
>         say @words.split(',');
>         say @nums.sin;
>
> gives us
>
>   ((a b) (c d))
>   (0 1 -1)
>
> Brian
>


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

Reply via email to