Skip to content

Commit a71cb14

Browse files
authored
Honey the pick description of Bool.rakudoc
I found the `Bool` page's `pick` doc hard to understand.¹ I eventually figured it out.² I have tried to improve it so it's easier to understand, especially for concrete thinkers.³ ¹ I initially thought that the `Bool` class's `pick` was perhaps an especially powerful abstraction which made it a bit difficult to describe and understand, but was ultimately worth the mental effort. ² I concluded the doc was probably just unhelpfully abstract. (Perhaps it was originally copy/pasted from some other class's `pick`?) ³ I concluded the `Bool` variant of `pick` was nice and easy, and I just needed to distill its simplicity while remaining technically correct.
1 parent c1afc35 commit a71cb14

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

doc/Type/Bool.rakudoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,20 @@ and any key.
8181
multi method pick(Bool:U: --> Bool:D)
8282
multi method pick(Bool:U: $count --> Seq:D)
8383

84-
Returns a random pick of C<True> or C<False> if called without any argument:
84+
Returns a random pick of C<True> and/or C<False>.
85+
86+
If it's called without an argument then it returns just one pick:
8587

8688
say Bool.pick; # OUTPUT: «True␤»
8789

88-
Returns a C<Seq> if called with an argument (C<$count>). The C<Seq> has one
89-
element, C<True> or C<False>, if C<$count> is one, and has two elements, one
90-
of them C<True>, the other C<False>, in random order, if C<$count> is C<*>
91-
or greater than or equal to two:
90+
If it's called with a C<$count> of one then it returns a C<Seq> with either
91+
C<True> or C<False>):
9292

9393
say Bool.pick(1); # OUTPUT: «(False)␤»
94+
95+
If C<$count> is C<*> or greater than or equal to two then it returns a two
96+
element C<Seq> that's either C<True> then C<False> or C<False> then C<True>:
97+
9498
say Bool.pick(*); # OUTPUT: «(False True)␤»
9599

96100
=head2 routine roll

0 commit comments

Comments
 (0)