PcollectFinal must look ahead in the stream by one value. It starts by getting two values and yielding the first. On the second call, it gets the third value and yields the second, and so on. This is the only way to know if the next value will be nil.
Potential problems:
If the source pattern uses Pkey to refer to values calculated outside PcollectFinal, the Pkey values will be out of sync (delayed by one event). The workaround is to wrap a Pbind inside PcollectFinal. See the examples.
If the source pattern refers to the current clock time, this will be out of sync.
If the source pattern generates a Rest, it may be applied incorrectly.
WARNING: These caveats suggest that this may not be an ideal solution. If I find a better approach later, I may remove this class. Avoid relying on it too much.