title: What uses can you think of for Perl 6's junctions?
body: <p>More information from <a href="http://en.wikipedia.org/wiki/Perl_6#Junctions" rel="noreferrer">the Perl 6 Wikipedia entry</a></p>
  
  <p><strong>Junctions</strong></p>
  
  <p>Perl 6 introduces the concept of junctions: values that are composites of other values.[24] In the earliest days of Perl 6's design, these were called "superpositions", by analogy to the concept in quantum physics of quantum superpositions — waveforms that can simultaneously occupy several states until observation "collapses" them. A Perl 5 module released in 2000 by Damian Conway called Quantum::Superpositions[25] provided an initial proof of concept. While at first, such superpositional values seemed like merely a programmatic curiosity, over time their utility and intuitiveness became widely recognized, and junctions now occupy a central place in Perl 6's design.</p>
  
  <p>In their simplest form, junctions are created by combining a set of values with junctive operators:</p>
  
  <pre><code>my $any_even_digit = 0|2|4|6|8; # any(0, 2, 4, 6, 8)
  my $all_odd_digits = 1&amp;3&amp;5&amp;7&amp;9; # all(1, 3, 5, 7, 9)
  </code></pre>
  
  <p>| indicates a value which is equal to either its left or right-hand arguments. &amp; indicates a value which is equal to both its left and right-hand arguments. These values can be used in any code that would use a normal value. Operations performed on a junction act on all members of the junction equally, and combine according to the junctive operator. So, ("apple"|"banana") ~ "s" would yield "apples"|"bananas". In comparisons, junctions return a single true or false result for the comparison. "any" junctions return true if the comparison is true for any one of the elements of the junction. "all" junctions return true if the comparison is true for all of the elements of the junction.</p>
  
  <p>Junctions can also be used to more richly augment the type system by introducing a style of generic programming that is constrained to junctions of types:</p>
  
  <pre><code>sub get_tint ( RGB_Color|CMYK_Color $color, num $opacity) { ... }
  sub store_record (Record&amp;Storable $rec) { ... }
  </code></pre>