Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the order of event handling for the spill function in Reactive-Banana?

I tested this and it seems that the order of event handling is the same as the order of the list in the source event. I don't think I can rely on this as the documentation only states:

Emit simultaneous event occurrences. Up to strictness, we have spill . collect = id

How can I create a function similar to spill with a specification like:

Emit sequential event occurrences with the guarantee that no other events will fire between the first and last

Or should I try a different approach? I am trying to implementing macro functionality in Reactive-Banana

like image 917
llayland Avatar asked Apr 10 '12 01:04

llayland


1 Answers

(I'm the author of reactive-banana.)

It seems that the order of event handling is the same as the order of the list in the source event.

This is correct, you can rely on that. In fact, it more or less follows from the equation spill . collect = id. After all, to yield the identity mapping, spill must preserve the order of the events ascollect has put them in the list.

Furthermore, you can inspect the source code of the modules Reactive.Banana.Model (Reactive.Banana.Internal.Model in version 0.5) and Reactive.Banana.Combinators. Taken together, they give an authoritative model implementation. You can directly check how spill behaves. (Though it may be a little confusing since the model is built in two parts.)

Nonetheless, I shall add a few words to the documentation.

like image 200
Heinrich Apfelmus Avatar answered Nov 15 '22 08:11

Heinrich Apfelmus