Re: colon pair confusion

[email protected] (Sean McAfee) Tue, 18 Nov 2025 23:29:02 -0800
Newsgroups perl.perl6.users
Message-ID <CANan03aCT6vPZZDmgR8gQBJyUSGGbAkkgWkVB1tawDK7nxPAWw@mail.gmail.com>
--0000000000008e47d90643ed891c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It's all spelled out here:
https://docs.raku.org/language/glossary#Adverbial_pair

Notice in particular that :foo means :foo(True) and :!foo means :foo(False)=
.
Also see that

[...] other circumfix operators with their usual semantics can be used for
stating the value, e.g. :foo[=E2=80=A6] for an array and :foo{=E2=80=A6} fo=
r a hash or even
a Block.

Therefore :foo() means a Pair whose key is the string "foo" and whose value
is the empty list.  Compare with :foo(1, 2, 3) which is the same as foo =3D=
>
(1, 2, 3).

On Tue, Nov 18, 2025 at 9:45=E2=80=AFPM ToddAndMargo via perl6-users <
[email protected]> wrote:

> Hi All,
>
> I am a bit confused as to what colon pairs are actually doing:
>
> [0] > my $y=3D:abc;
> abc =3D> True
> Why is this True and not Nil?
>
>
> [1] > my $y=3D:abc(123);
> abc =3D> 123
> This I get.
>
>
> [2] > my $y=3D:abc();
> abc =3D> ()
> Why is this () and not Nil?
>
>
> [3] > my $y=3D:abc(Nil);
> abc =3D> Nil
> This I get
>
>
> Yours in Confusion,
> -T
>
>

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

<div dir=3D"ltr"><div>It&#39;s all spelled out here:=C2=A0<a href=3D"https:=
//docs.raku.org/language/glossary#Adverbial_pair">https://docs.raku.org/lan=
guage/glossary#Adverbial_pair</a></div><div><br></div><div>Notice in partic=
ular that <span style=3D"font-family:monospace">:foo</span> means <span sty=
le=3D"font-family:monospace">:foo(True)</span> and <span style=3D"font-fami=
ly:monospace">:!foo</span> means <span style=3D"font-family:monospace">:foo=
(False)</span>.=C2=A0 Also see that</div><div><br></div><div style=3D"margi=
n-left:40px">[...] other circumfix operators with their usual semantics can=
 be used for stating the value, e.g. <code>:foo[=E2=80=A6]</code> for an ar=
ray and <code>:foo{=E2=80=A6}</code> for a hash or even a <code>Block</code=
>.</div><div><br></div><div>Therefore <span style=3D"font-family:monospace"=
>:foo()</span>=C2=A0means a Pair whose key is the string <span style=3D"fon=
t-family:monospace">&quot;foo&quot;</span> and whose value is the empty lis=
t.=C2=A0 Compare with <span style=3D"font-family:monospace">:foo(1, 2, 3)</=
span> which is the same as <span style=3D"font-family:monospace">foo =3D&gt=
; (1, 2, 3)</span>.</div><br><div class=3D"gmail_quote gmail_quote_containe=
r"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Nov 18, 2025 at 9:45=E2=80=
=AFPM ToddAndMargo via perl6-users &lt;<a href=3D"mailto:[email protected]=
rg">[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail=
_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204=
,204);padding-left:1ex">Hi All,<br>
<br>
I am a bit confused as to what colon pairs are actually doing:<br>
<br>
[0] &gt; my $y=3D:abc;<br>
abc =3D&gt; True<br>
Why is this True and not Nil?<br>
<br>
<br>
[1] &gt; my $y=3D:abc(123);<br>
abc =3D&gt; 123<br>
This I get.<br>
<br>
<br>
[2] &gt; my $y=3D:abc();<br>
abc =3D&gt; ()<br>
Why is this () and not Nil?<br>
<br>
<br>
[3] &gt; my $y=3D:abc(Nil);<br>
abc =3D&gt; Nil<br>
This I get<br>
<br>
<br>
Yours in Confusion,<br>
-T<br>
<br>
</blockquote></div></div>

--0000000000008e47d90643ed891c--