I'm looking at the Perl6 code in rakudo-star, because I have some ideas about junctions, and I want to see how they correspond to what's actually being implemented.

Junction.pir has a lot of stuff, but it's fairly low-level, so it doesn't add up to all that much, just what you expect, new(), boolean comparisons, .perl .... Junction.pm is tiny and contains something interesting ... but challenging to decypher:

method postcircumfix:<( )>($c) { my @result = $.eigenstates.map({ $^code(|$c) }); Junction.new(@result, type => self!type); }

It defines parentheses that go after the junction object, wrapped around an argument that's assigned to the parameter $c, I think. The Junction 1 | 2 | 3 has one attribute $.type which in this case is any, and another attribute $.eigenstates containing the list (1,2,3). So the body of the method is map-ing across the list with the code block { $^code(|$c) }. $^code is an anonymous positional parameter ... the only one in the code block, and it uses the postcircumflex parameter $c as it's argument ... but what is $^code? What is a reasonable value for the $c? I tried:

my $k = $j2 ); my $k = $j( {^c != 2} ); # But both generated the message .. invoke() not implemented in class 'Integer'

My hope is that there is a way to alter a Junction object. In Sudoku, every cell begins with the potential to be any digit:  1|2|3|4|5|6|7|8|9. As cells are initialize to a specific value, all cells in the same row, the same column, and the same region (What's a quadrant when there are nine of them?) no longer have the potential to contain that value.</>

Alternately, the Conway-esque Quantum Superposition interpretation is that the cells ARE all those values at the same time: 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9. As cells are assigned values, the related cells lose the potential to contain that value ... one little Schrodinger's Digit dies, until each cells has a single specific value.

It would be equally useful for other problems which involve building up combinations or narrowing down possibilities: games like Battleships, Fish or Canasta, crossword puzzles, Hangman ... not necessarily the best solution for any of them, I'm saying, but a possibility.

I was hoping that that postcircumflex multi would enable me to do the necessary building up, or breaking of cyanide capsules, but at the moment, I'm confused

As Occam said: Entia non sunt multiplicanda praeter necessitatem.


In reply to Perl6 junctions and postcircumflex by TomDLux

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.