I don't know Haskell, but isn't flip just:

sub flip(&f) { -> $b, $a, |c { f($a, $b, |c) } }

And then:

perl6 -e 'sub flip(&f) { -> $a, $b, |c { f($b, $a, |c) } }; my &yas = flip
&say; yas(1,2,3)'
213


Aaron Sherman, M.:
P: 617-440-4332 Google Talk, Email and Google Plus: a...@ajs.com
Toolsmith, developer, gamer and life-long student.


On Wed, Sep 7, 2016 at 6:13 PM, Brandon Allbery <allber...@gmail.com> wrote:

> On Wed, Sep 7, 2016 at 6:08 PM, Parrot Raiser <1parr...@gmail.com> wrote:
>
>> There is a "flip" in P6, to reverse the characters in a string, and a
>> "reverse", to return the elements of a list. Would either of those be
>> an equivalent?
>>
>
> Not without an "apply" mechanism used for function / method / operator
> invocations. Which is almost viable in Perl 6 since the parameters get
> passed as a list --- except that the list is only visible within the
> implementation, not at the call site (which is what "apply" does).
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>

Reply via email to