The idea is that junctions should usually be invisible to the code,
and autothreading handles them behind the scenes.  Once you start
using the eigenstates as a collection, you're breaking the model and
not gaining anything over just using a regular collection type.
    But the "behind the scenes" model fails when a junction passes
through a condition into guarded code that assumes the condition is
true, unless the eigenstates inside the guard are restricted to those
for which the condition is true.

Consider:

my $x = 2|0;
my $y = $x ?? 1/$x !! 0;

The expected result is presumably $y == 0|.5, but if the $x in the
denominator isn't restricted to the eigenstates that pass the
conditional, you get a divide by zero in one of the autothreads.

The code needs to behave as if each eigenstate is treated
independently by a separate thread, and only combined back into a
junction at the end of each autothreaded block, even if the
implementation doesn't actually do it that way.  We can't just test a
junction using its junctive semantics and fall through with the
junction intact.

To go back to the Blackjack example: for junctions to apply, code
written with the assumption that each hand's sum is a simple number
should work when they're actually junctions.  But that's not the case
because the end goal is to pick a single winner, not a junction of
possible winners depending on how you assign values to the Aces.
There are specific rules for the selection of Ace values that don't
necessarily follow junctive semantics, and just letting things thread
through will not yield the right answer in all cases.

(Yes, for those keeping score at home, I changed my mind about the
applicability of junctions to that problem...)

On 4/1/09, Jon Lang <datawea...@gmail.com> wrote:
> On Wed, Apr 1, 2009 at 12:58 AM, Richard Hainsworth
> <rich...@rusrating.ru> wrote:
>> Thinking about Jon Lang's -1|+1 example in another way, I wondered about
>> simultaneous conditions.
>>
>> Consider
>>
>> $x = any (1,2,5,6)
>>
>> How do we compose a conditional that asks if any of this set of
>> eigenstates
>> are simultaneously both > 2 and < 5?
>> Clearly the desired answer for $x is False, but
>>
>> my $x = any(1,2,5,6); say ?( 2 < $x < 5); # true
>>
>> Is there some combination of any/all that will achieve this?
>
> As Carl indicated, there are other ways to do this.  For instance, s/
> 2 < $x < 5 / $x ~~ 2 ^..^ 5 /.  But as I indicated in a recent email,
> part of my concern is that those two expressions _ought to be_
> equivalent: changing the junction, or making do without one as Carl
> proposes, doesn't fix this lack of equivalence.
>
> As for Carl's proposed alternative: no, it isn't _much_ longer (but it
> _is_ longer), and _perhaps_ it's _slightly_ more understandable - or
> perhaps not.  Other than making the implementors' lives harder, what's
> wrong with trying to find a way to get Jonathan's example to work the
> way people expect it to?
>
> I don't understand this aversion to everything remotely hinting of
> eigenstates/eigenthreads/threshing/whatever.
>
> --
> Jonathan "Dataweaver" Lang
>

-- 
Sent from my mobile device

Mark J. Reed <markjr...@gmail.com>

Reply via email to