Skip to content

Commit c6159f8

Browse files
committed
Adds example of (unintended) numification of lists
Which would probably close #1664.
1 parent b996242 commit c6159f8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

doc/Language/traps.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,18 @@ say @colors.roll; # blue
405405
say @colors.pick(2); # yellow violet (cannot repeat)
406406
say @colors.roll(3); # red green red (can repeat)
407407
408+
=head2 List numify to their number of elements in numeric context
409+
410+
You want to check whether a number is divisible by any of a set of numbers:
411+
412+
say 42 %% <11 33 88 55 111 20325>; # OUTPUT: «True␤
413+
414+
What? There's no single number 42 should be divisible by. However, that list has 6 elements, and 42 is divisible by 6. That's why the output is true. In this case, you should turn the C<List> into a L<Junction>:
415+
416+
say 42 %% <11 33 88 55 111 20325>.any;# OUTPUT: «any(False, False, False, False, False, False)␤»
417+
418+
which will clearly reveal the falsehood of the divisiveness of all the numbers in the list, which will be numified separately.
419+
408420
=head1 Arrays
409421
410422
=head2 Referencing the last element of an array

xt/words.pws

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,4 +1375,7 @@ zoffixznet
13751375
zwj
13761376
mmk
13771377
FQN
1378-
NewType
1378+
NewType
1379+
dex
1380+
oðin
1381+
numified

0 commit comments

Comments
 (0)