Basic building blocks of Functional reactive programming(FRP): IOS
Every massive structure has basic units that come together and make sense to the whole structure. For example, bricks, cement, paint, concrete, and so on make up basic building blocks on a building. Similarly, before we go ahead and discuss the massive field of functional reactive programming, it would be great if we understood the basic building blocks that will come together so that the massive applications that we create make sense.Let’s have a look at some of the basic building blocks of FRP, starting with event streams.
Event streams
An event stream can be defined as a sequence of events happening over time; you can think of it as an asynchronous array. A simple description of an event stream is shown in the following diagram:
As you can see, we have expressed time on the arrow aligned from left to right, moving forward to the right, and events happen over time. The coloured bubbles (indicated by their names) drawn at intermittent intervals on the timeline represent the events. We can add an event listener to the whole sequence and whenever an event happens, WE CAN REACT TO IT by doing something…