4

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

jhegedus
  • 20,244
  • 16
  • 99
  • 167

1 Answers1

4
  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);
    }
    
Tomas Mikula
  • 6,537
  • 25
  • 39
  • Tomas, could you please also comment on the latest edit ? How to implement snapshot-hold loop in ReactFX ? – jhegedus Apr 03 '15 at 09:09
  • @jhegedus can you post sample code with explanation of a snapshot-hold loop, or a link to such sample? – Tomas Mikula Apr 03 '15 at 15:37
  • I gave a detailed talk about it three days ago at our local FRP Meetup, videos should go online in a few days (after editing). I keep you posted. – jhegedus Apr 04 '15 at 05:17
  • Is there support for recursively dependency like in Sodium? In sodium it would be a `snapshot` outputting a value to `hold`, which feeds its value back to `snapshot`. This achieves a storage of a state. BTW, the book seems to be complete as of 2017 – Carl Dong Jan 10 '17 at 20:35