Patrick R. Michaud via RT wrote:
I'd like to get a clarification from p6l as to whether junction states
should be made unique before applying or rejecting this patch. I'm
particularly curious about one() junctions.
Also, it seems like it would be better to make the list unique inside of
!MAKE_JUNCTION instead of duplicating this code throughout all of the
junction constructors. This would also avoid creating yet another
private function.
Revised patch attached.
--
Bacek
diff --git a/languages/perl6/src/classes/Junction.pir b/languages/perl6/src/classes/Junction.pir
index 5008892..fbc7b40 100644
--- a/languages/perl6/src/classes/Junction.pir
+++ b/languages/perl6/src/classes/Junction.pir
@@ -214,10 +214,16 @@ Return the components of the Junction.
$P0 = get_hll_global 'Junction'
junc = $P0.'new'()
setattribute junc, '$!type', type
+
+ # Uniquefy eigenstates if possible
+ if type == JUNCTION_TYPE_ONE goto set_eugenstates
+ $P0 = get_hll_global 'infix:==='
+ eigenstates = eigenstates.'uniq'($P0)
+ set_eugenstates:
setattribute junc, '@!eigenstates', eigenstates
.return (junc)
.end
-
+
.sub '!DISPATCH_JUNCTION'
.param pmc the_sub
.param pmc args :slurpy