As I understand, it’s possible to use a standalone Event in a Pchain, to be combined with a Pbind:
(
p = Pbind(\a, 1);
x = Pchain((b: 2), p).asStream;
)
x.next(()); // -> ( 'a': 1, 'b': 2 )
But, when using the <>
syntax shortcut, the previous example returns nil
:
(
p = Pbind(\a, 1);
x = ((b: 2) <> p).asStream;
)
x.next(()); // -> nil
What seems even stranger is that the <>
example works normally if the two terms are swapped:
(
p = Pbind(\a, 1);
x = (p <> (b: 2)).asStream;
)
x.next(()); // -> ( 'a': 1, 'b': 2 )
But of course, order can be significant in the context of pattern composition. Can anyone explain this behavior?
Eli