develooper Front page | perl.perl6.users | Postings from March 2021

Re: 'CALL-ME' Math problem?

Thread Next
Kevin Pye
March 2, 2021 08:34
Re: 'CALL-ME' Math problem?
Message ID:
Just because mathematics allows an implied multiplication doesn't mean Raku
does -- in fact I can't think of any programming language which does. You
need to stick an explicit multiplication operator ('*' or '×') between the
5 and the left parenthesis.

The reason for the error message is that adding parentheses after something
is interpreted as trying to invoke a function. Callable objects such as
functions have a CALL-ME method which is what is invoked to call the
function. An integer lacks such a method, since it isn't callable.

On Tue, 2 Mar 2021 at 19:13, ToddAndMargo via perl6-users <> wrote:

> Hi All,
> Math problem:
>      x = 60÷5(7−5)
> raku -e 'say 60÷5(7−5)'
> No such method 'CALL-ME' for invocant of type 'Int'
>    in block <unit> at -e line 1
> Seems raku does not like the ().  How do I fix this
> and maintain the flow and look of the equation?
> -T
> The correct answer is 24

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About