On 02/03/2021 09:12, ToddAndMargo via perl6-users wrote:
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 at -e line 1
Seems raku does not like the (). How do I fix this
and maintain the flow and look of the equation?
Not in this case. The error happens at run-time. Syntactically the expression
is a valid one because `5(...)` is interpreted as an invocation. Raku
implements invocation protocol a part of which is method 'CALL-ME' defined on a
class:
class Foo {
method CALL-ME(|c) { say "Foo invoked with
On Tue, Mar 2, 2021 at 4:08 PM Matthew Stuckwisch
wrote:
> But why do that when you can add a CALL-ME to the number classes that does
> multiplication?
>
> Int.^add_fallback(
> {$^i.defined && $^m eq 'CALL-ME'},
> -> $, $ { * * * }
> );
>
> say 5(4); # 20
>
say 5(5)² # 625… oops!
But why do that when you can add a CALL-ME to the number classes that does
multiplication?
Int.^add_fallback(
{$^i.defined && $^m eq 'CALL-ME'},
-> $, $ { * * * }
);
say 5(4); # 20
On Tue, Mar 2, 2021, 09:08 Daniel Sockwell wrote:
> Kevin Pye wrote:
> > Just because mathematics
> Doing so would, of course, be a very bad idea. But still, you _could_.
Something of an understatement, I think. :-)*
Seriously, this made me wonder if inscrutable error messages might be
clarifed by a (reverse) trace of the last few steps in parsing. That
would show you what the compiler
Kevin Pye wrote:
> Just because mathematics allows an implied multiplication doesn't mean Raku
> does -- in fact I can't
> think of any programming language which does.
As a (potentially) interesting side note, while Raku doesn't provide implied
multiplication, it _is_
one of the few
>>
>> 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 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
On Tue, 2 Mar 2021, 08:13 ToddAndMargo via perl6-users,
mailto:perl6-us...@perl.org>> 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 at -e line 1
Seems raku does not like
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
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 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
10 matches
Mail list logo