On Sat, Feb 12, 2005 at 03:28:15AM +0800, Autrijus Tang wrote: > On Fri, Feb 11, 2005 at 09:42:06AM +0000, Thomas Yandell wrote: > > Is there another operator that takes the intersection of two > > junctions, such that any(2,3,4,5) *some op* any(4,5,6,7) would result > > in any(4,5)? > > Yes. In Pugs 6.0.3 (released one minute ago), that operator is > simply called "&": > > % ./pugs -e "(any(2,3,4,5) & any(4,5,6,7)).perl" > ((2 | 3 | 4 | 5 | 6 | 7)) > > That is, the "&" builder now automagically collapses nested > junctions under it. I intend to fill in the rest of the collapse > logic tomorrow, after some feedback from the list.
This collapse is probably wrong. In particular, any($a, $b) & any($b, $c) is not the same as any($a, $b, $c) To see this, set $a=1, $b=0, $c=0: any($a, $b) & any($b, $c) -> any(1,0) & any(0,0) -> false any($a, $b, $c) -> any(1, 0, 0) -> true > Consider: > > all( one(1, 2), one(2, 3) ) > > Should it be collapsed into: > > any( one(1, 3), 2 ) > > so that "2" now only occurs once? Is it sane? No, it's wrong. all( one(1, 2), one(2, 3) ) # false any( one(1, 3), 2) # true There might be some junctions that can be "collapsed", but these aren't examples of them. Pm