Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Point out corner case of all()
This is probably better said here than in traps.pod
  • Loading branch information
skids committed Jan 24, 2015
1 parent ea35d8e commit f84804e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Type/Junction.pod
Expand Up @@ -61,6 +61,14 @@ Usage examples:
my @primes_ending_in_1 = grep &is_prime & / 1$ /, 2..100;
say @primes_ending_in_1; # 11 31 41 61 71
Special care should be taken when using C<all> with arguments that may
produce an empty list:
my @a = ();
so all(@a) # True, because there are 0 False's
so all(@a, ?@a) # Does what you might have meant by the above
so all(@a, True) # Explicit way to express the first example
Negated operators are special-cased when it comes to autothreading.
C<$a !op $b> is rewritten internally as C<!($a op $b)>. The outer
negation collapses any junctions, so the return value always a plain
Expand Down

0 comments on commit f84804e

Please sign in to comment.