square root question

Hi All,

Am I pushing it with the unicodes here?

say sqrt(2)
1.4142135623730951

say 2.sqrt
1.4142135623730951

say =C2=BD*2.sqrt
0.7071067811865476


say 2.=E2=88=9A
=3D=3D=3DSORRY!=3D=3D=3D Error while compiling:
Malformed postfix call
------> say 2.=E2=8F=8F=E2=88=9A

say =E2=88=9A2
=3D=3D=3DSORRY!=3D=3D=3D
Argument to "say" seems to be malformed
------> say=E2=8F=8F =E2=88=9A2
Bogus postfix
------> say =E2=8F=8F=E2=88=9A2
     expecting any of:
         infix
         infix stopper
         postfix
         statement end
         statement modifier
         statement modifier loop


Many thanks,
-T
0
perl6
12/15/2019 1:43:03 AM
perl.perl6.users 1389 articles. 0 followers. Follow

5 Replies
56 Views

Similar Articles

[PageSpeed] 43

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.=E2=88=9A
>> =3D=3D=3DSORRY!=3D=3D=3D Error while compiling:
>> Malformed postfix call
>> ------> say 2.=E2=8F=8F=E2=88=9A
>>
>=20
> =E2=88=9A is not a valid identifier character, so this can't be a metho=
d.
>=20
>> say =E2=88=9A2
>> =3D=3D=3DSORRY!=3D=3D=3D
>> Argument to "say" seems to be malformed
>> ------> say=E2=8F=8F =E2=88=9A2
>> Bogus postfix
>>
>=20
> It still can be an operator though. It's not in core Raku but that
> shouldn't stop you:
>=20
>    multi prefix:<=E2=88=9A> (Cool:D $x) { $x.sqrt }
>    say =E2=88=9A2  #=3D 1.4142135623730951
>=20
> The default prefix operator precedence seems to be fitting for how
> far the Unicode square root symbol extends:
>=20
>    say =E2=88=9A2+1    #=3D 2.4142135623730951
>    say =E2=88=9A(2+1)  #=3D 1.7320508075688772
>=20
> Regards,
> Tobias
>=20

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:<=E2=88=9A> (Cool:D $x) { $x.sqrt }
&prefix:<=E2=88=9A>

 > say =E2=88=9A2
=3D=3D=3DSORRY!=3D=3D=3D
Argument to "say" seems to be malformed
------> say=E2=8F=8F =E2=88=9A2
Bogus postfix
------> say =E2=8F=8F=E2=88=9A2
     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=20
meant to call it as a method on $_, or use an explicit invocant or=20
argument, or use &say to refer to the function as a noun
     ------> say=E2=8F=8F =E2=88=9A2
0
perl6
12/15/2019 3:32:47 AM
On Sat, 14 Dec 2019, ToddAndMargo wrote:
> 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

If this is inside the REPL, it's not your fault. It's a known issue:
https://github.com/rakudo/rakudo/issues/2245

Regards,
Tobias

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
0
tobs
12/15/2019 10:56:34 AM
On 2019-12-15 02:56, Tobias Boege wrote:
> On Sat, 14 Dec 2019, ToddAndMargo wrote:
>> What am I doing wrong here?
>>
>>> multi prefix:<=E2=88=9A> (Cool:D $x) { $x.sqrt }
>> &prefix:<=E2=88=9A>
>>
>>> say =E2=88=9A2
>> =3D=3D=3DSORRY!=3D=3D=3D
>> Argument to "say" seems to be malformed
>> ------> say=E2=8F=8F =E2=88=9A2
>> Bogus postfix
>=20
> If this is inside the REPL, it's not your fault. It's a known issue:
> https://github.com/rakudo/rakudo/issues/2245
>=20
> Regards,
> Tobias
>=20

Hi Tobias,

Well now, its really not me?  That is an odd feeling.

For my keeper on the subject, I searched the documentation
for "prefix:" and found a gazillion entries.  A lot of
how use it other things with it, but nothing specifically
for "prefix:".   Do you know if one exists?

Many thanks,
-T
0
perl6
12/15/2019 8:15:23 PM
--0000000000008b36be0599c3f6c3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

https://docs.raku.org/language/optut

This should cover it.

On Sun, 15 Dec 2019, 20:17 ToddAndMargo via perl6-users, <
perl6-users@perl.org> wrote:

> On 2019-12-15 02:56, Tobias Boege wrote:
> > On Sat, 14 Dec 2019, ToddAndMargo wrote:
> >> What am I doing wrong here?
> >>
> >>> multi prefix:<=E2=88=9A> (Cool:D $x) { $x.sqrt }
> >> &prefix:<=E2=88=9A>
> >>
> >>> say =E2=88=9A2
> >> =3D=3D=3DSORRY!=3D=3D=3D
> >> Argument to "say" seems to be malformed
> >> ------> say=E2=8F=8F =E2=88=9A2
> >> Bogus postfix
> >
> > If this is inside the REPL, it's not your fault. It's a known issue:
> > https://github.com/rakudo/rakudo/issues/2245
> >
> > Regards,
> > Tobias
> >
>
> Hi Tobias,
>
> Well now, its really not me?  That is an odd feeling.
>
> For my keeper on the subject, I searched the documentation
> for "prefix:" and found a gazillion entries.  A lot of
> how use it other things with it, but nothing specifically
> for "prefix:".   Do you know if one exists?
>
> Many thanks,
> -T
>

--0000000000008b36be0599c3f6c3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><a href=3D"https://docs.raku.org/language/optut">https://=
docs.raku.org/language/optut</a>=C2=A0<div dir=3D"auto"><br></div><div dir=
=3D"auto">This should cover it.</div></div><br><div class=3D"gmail_quote"><=
div dir=3D"ltr" class=3D"gmail_attr">On Sun, 15 Dec 2019, 20:17 ToddAndMarg=
o via perl6-users, &lt;<a href=3D"mailto:perl6-users@perl.org">perl6-users@=
perl.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2019-12-=
15 02:56, Tobias Boege wrote:<br>
&gt; On Sat, 14 Dec 2019, ToddAndMargo wrote:<br>
&gt;&gt; What am I doing wrong here?<br>
&gt;&gt;<br>
&gt;&gt;&gt; multi prefix:&lt;=E2=88=9A&gt; (Cool:D $x) { $x.sqrt }<br>
&gt;&gt; &amp;prefix:&lt;=E2=88=9A&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt; say =E2=88=9A2<br>
&gt;&gt; =3D=3D=3DSORRY!=3D=3D=3D<br>
&gt;&gt; Argument to &quot;say&quot; seems to be malformed<br>
&gt;&gt; ------&gt; say=E2=8F=8F =E2=88=9A2<br>
&gt;&gt; Bogus postfix<br>
&gt; <br>
&gt; If this is inside the REPL, it&#39;s not your fault. It&#39;s a known =
issue:<br>
&gt; <a href=3D"https://github.com/rakudo/rakudo/issues/2245" rel=3D"norefe=
rrer noreferrer" target=3D"_blank">https://github.com/rakudo/rakudo/issues/=
2245</a><br>
&gt; <br>
&gt; Regards,<br>
&gt; Tobias<br>
&gt; <br>
<br>
Hi Tobias,<br>
<br>
Well now, its really not me?=C2=A0 That is an odd feeling.<br>
<br>
For my keeper on the subject, I searched the documentation<br>
for &quot;prefix:&quot; and found a gazillion entries.=C2=A0 A lot of<br>
how use it other things with it, but nothing specifically<br>
for &quot;prefix:&quot;.=C2=A0 =C2=A0Do you know if one exists?<br>
<br>
Many thanks,<br>
-T<br>
</blockquote></div>

--0000000000008b36be0599c3f6c3--
0
simon
12/15/2019 8:30:04 PM
On 2019-12-15 12:30, Simon Proctor wrote:
> https://docs.raku.org/language/optut
>=20
> This should cover it.
>=20
> On Sun, 15 Dec 2019, 20:17 ToddAndMargo via perl6-users,=20
> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>=20
>     On 2019-12-15 02:56, Tobias Boege wrote:
>      > On Sat, 14 Dec 2019, ToddAndMargo wrote:
>      >> What am I doing wrong here?
>      >>
>      >>> multi prefix:<=E2=88=9A> (Cool:D $x) { $x.sqrt }
>      >> &prefix:<=E2=88=9A>
>      >>
>      >>> say =E2=88=9A2
>      >> =3D=3D=3DSORRY!=3D=3D=3D
>      >> Argument to "say" seems to be malformed
>      >> ------> say=E2=8F=8F =E2=88=9A2
>      >> Bogus postfix
>      >
>      > If this is inside the REPL, it's not your fault. It's a known is=
sue:
>      > https://github.com/rakudo/rakudo/issues/2245
>      >
>      > Regards,
>      > Tobias
>      >
>=20
>     Hi Tobias,
>=20
>     Well now, its really not me?=C2=A0 That is an odd feeling.
>=20
>     For my keeper on the subject, I searched the documentation
>     for "prefix:" and found a gazillion entries.=C2=A0 A lot of
>     how use it other things with it, but nothing specifically
>     for "prefix:".=C2=A0 =C2=A0Do you know if one exists?
>=20
>     Many thanks,
>     -T


Hi Simon,

I now have my reference entered on my keeper.
Thank you!

Reference(s):
     https://docs.raku.org/language/optut

        # Alternatively we could create a more
        # general operator to sum n numbers
        sub prefix:<=CE=A3>( *@number-list ) {
            [+] @number-list
        }

        say =CE=A3 (13, 16, 1); # OUTPUT: =C2=AB30=E2=90=A4=C2=BB


I have to say that Tobias is a lot better at explaining it.
So I included his stuff too.

-T



--=20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
perl6
12/15/2019 8:51:16 PM
Reply: