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

1

6

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

Foul answered 10/4, 2012 at 1:16 Comment(0)
D
3

(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.

Delight answered 10/4, 2012 at 7:28 Comment(1)
And thank you for the library. I am really enjoying learning FRP with it.Foul

© 2022 - 2024 — McMap. All rights reserved.