develooper Front page | perl.perl6.language | Postings from March 2009

Re: Junction Algebra

Thread Previous | Thread Next
Martin Kealey
March 30, 2009 21:21
Re: Junction Algebra
Message ID:
On Mon, 30 Mar 2009, Mark J. Reed wrote:
> >        ( $a <= any(-1,+1) <= $b ) == ( $a <= any(-1,+1) && any(-1,+1) <= $b )
> Clearly, the RHS is true for $a == $b == 0, but I'm not sure the LHS
> shouldn't also be.  Isn't it just syntactic sugar for the RHS?

I suspect not. Rather I think that

	$a <= any(-1,+1) <= $b

corresponds to

	$tmp = any(-1,+1);
	$a <= $tmp <= $b

and thence to

	$tmp = any(-1,+1);
	$a <= $tmp && $tmp <= $b

The more I think about this, the more I come to the conclusion that a
junction should appear to have a uniform (single) value in each

> Logically, you might want it to mean something like ∃$x: $x == any(-1,+1)
> && $a <= $x && $x <= $b, but I don't think it does.

I think that flows fairly cleanly from the Junction-isa-Object
implementation, and the way that references are taken.

This is not going to play well with subexpression folding: junctions have to
be considered "unclean", in that two junctions must not be merged even if
they're immutable and indistinguishable (except for object identity).

	$a = any($x, $y);
	$b = any($x, $y);
	assert $a !== $b;

Earlier Moritz suggested that one could modify an external object from
within the eigenthreads to accumulate the list of eigenstates, in defiance
of having the !eigenstates() method private.

That's almost reasonable, but it assumes that eigenthreads don't work on
separate snapshot copies of the world, and that those snapshots aren't
discarded after their results are flattened by the junctive operator.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About