On 2019-12-14 18:43, Tobias Boege wrote:
On Sat, 14 Dec 2019, ToddAndMargo via perl6-users wrote:
Hi All,
Am I pushing it with the unicodes here?
say 2.√
===SORRY!=== Error while compiling:
Malformed postfix call
------> say 2.⏏√
√ is not a valid identifier character, so this can't be a method.
say √2
===SORRY!===
Argument to "say" seems to be malformed
------> say⏏ √2
Bogus postfix
It still can be an operator though. It's not in core Raku but that
shouldn't stop you:
multi prefix:<√> (Cool:D $x) { $x.sqrt }
say √2 #= 1.4142135623730951
The default prefix operator precedence seems to be fitting for how
far the Unicode square root symbol extends:
say √2+1 #= 2.4142135623730951
say √(2+1) #= 1.7320508075688772
Regards,
Tobias
Hi Tobias,
Awesome! I am going to have a lot of fun with this!
Thank you!
-T
What am I doing wrong here?
> multi prefix:<√> (Cool:D $x) { $x.sqrt }
&prefix:<√>
> say √2
===SORRY!===
Argument to "say" seems to be malformed
------> say⏏ √2
Bogus postfix
------> say ⏏√2
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier
statement modifier loop
Other potential difficulties:
Unsupported use of bare "say"; in Perl 6 please use .say if you
meant to call it as a method on $_, or use an explicit invocant or
argument, or use &say to refer to the function as a noun
------> say⏏ √2