ReactFX compared to Sodium

547 views Asked by At

This book about Sodium is a good and clear intro to FRP.

I expect that - because the book on Sodium is easy to understand - by comparing the two libraries (Sodium and ReactFX) people can leverage what they learn from the book and use that knowledge to implement GUIs in ReactFX.

This is the motivation for posting this question.

So I ask 11 questions that will help to achieve this goal:

what is the corresponding notion in ReactFX to the following 11 Sodium concepts ?

1 Cell/Behaviour

2 Stream/Event

3 filter

4 merge

5 coalesce

6 switch

7 never

8 hold

9 snapshot

10 map

11 lift

EDIT:

12 CellLoop/snapshot-hold-loop

1

There are 1 answers

4
Tomas Mikula On BEST ANSWER
  1. Cell/Behaviour: Val
  2. Stream/Event: EventStream
  3. filter: filter
  4. merge: merge
  5. coalesce: N/A. Coalesce regards transactions, something that ReactFX does not have. There are two related operators in ReactFX: reducible and onRecurseReduce, but neither is exactly the same.
  6. switch: flatMap
  7. never: never
  8. hold: toBinding
  9. snapshot: emitOn
  10. map: map
  11. lift: wrapper around combine:

    <A, B, C> BiFunction<Val<A>, Val<B>, Val<C>> lift(BiFunction<A, B, C> f) {
        return (va, vb) -> Val.combine(va, vb, f);
    }