develooper Front page | perl.perl6.users | Postings from December 2017

Call a function in a Whatever star

From:
Sean McAfee
Date:
December 13, 2017 22:05
Subject:
Call a function in a Whatever star
Message ID:
CANan03aUmLE2cv_09F+8na4eQv7TNS2aAuPxnHXshp3kwWP38A@mail.gmail.com
I just tried doing this:

> map *(1), *+1, *+2, *+3

But I get an error: "No such method 'CALL-ME' for invocant of type
'Whatever'".  Fair enough.

This works:

> map { $_(1) }, *+1, *+2, *+3
(2 3 4)

Is there any alternative way to call a function through a whatever-star, as
in my first example?



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