Questions tagged [perl6-junction]

Use for questions about the Perl 6 Junction type.

Perl 6 Junctions are a type of value that can represent multiple states at the same time. It collapses to a single Boolean value in tests.

5 questions
13
votes
1 answer

Double junction arguments swapping sides

I'm confused about how double junctions are supposed to work. This makes some sense: say all('a', 'b', 'c') ~ any('d', 'e'); gives all(any(ad, ae), any(bd, be), any(cd, ce)) This doesn't make sense: say any('a', 'b', 'c') ~ all('d',…
9
votes
2 answers

Why do + and ~ affect Perl 6 junctions differently?

Add one to a junction of Ints: put any( 1, 3, 7 ) + 1; Now you have a junction of those Ints increased by one: any(2, 4, 8) So, 2 == any(2, 4, 8) is true. Make a junction of strings and append to those strings: put any( ) ~ 'amadryas'; You…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
8
votes
1 answer

Where is contains( Junction) defined?

This code works: (3,6...66).contains( 9|21 ).say # OUTPUT: «any(True, True)␤» And returns a Junction. It's also tested, but not documented. The problem is I can't find its implementation anywhere. The Str code, which is also called from Cool,…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
7
votes
1 answer

Can gather be used to unroll Junctions?

In this program: use v6; my $j = +any "33", "42", "2.1"; gather for $j -> $e { say $e; } # prints 33␤42␤2.1␤ for $j -> $e { say $e; # prints any(33, 42, 2.1) } How does gather in front of forchange the behavior of the Junction, allowing to…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
7
votes
1 answer

In Perl 6, how can I replicate the behavior of Perl's List::Util::all?

I am trying to use a Junction to replicate behavior I am used to in Perl from List::Util::all. I am using the all junction in the following statement: # does not work return not know(@possible-dates) and not know tell day all(@possible-dates); not…
Hunter McMillen
  • 59,865
  • 24
  • 119
  • 170