All Projects → biaslab → Rocket.jl

biaslab / Rocket.jl

Licence: mit
Functional reactive programming extensions library for Julia

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to Rocket.jl

Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+9623.19%)
Mutual labels:  reactive-programming, functional-reactive-programming, reactive-extensions, framework
Awesome Rxjs
A collection of awesome RxJS resources
Stars: ✭ 314 (+355.07%)
Mutual labels:  reactive, reactive-programming, functional-reactive-programming, reactive-extensions
ObservableComputations
Cross-platform .NET library for computations whose arguments and results are objects that implement INotifyPropertyChanged and INotifyCollectionChanged (ObservableCollection) interfaces.
Stars: ✭ 94 (+36.23%)
Mutual labels:  observable, reactive-programming, reactive-extensions, functional-reactive-programming
realar
5 kB Advanced state manager for React
Stars: ✭ 41 (-40.58%)
Mutual labels:  reactive, observable, reactive-programming
Smallrye Mutiny
An Intuitive Event-Driven Reactive Programming Library for Java
Stars: ✭ 231 (+234.78%)
Mutual labels:  reactive, asynchronous, reactive-extensions
Pharmacist
Builds observables from events.
Stars: ✭ 221 (+220.29%)
Mutual labels:  observable, reactive-programming, reactive-extensions
assembler
Functional, type-safe, stateless reactive Java API for efficient implementation of the API Composition Pattern for querying/merging data from multiple datasources/services, with a specific focus on solving the N + 1 query problem
Stars: ✭ 102 (+47.83%)
Mutual labels:  reactive, reactive-programming, functional-reactive-programming
purescript-pop
😃 A functional reactive programming (FRP) demo created with PureScript events and behaviors.
Stars: ✭ 33 (-52.17%)
Mutual labels:  reactive, reactive-programming, functional-reactive-programming
fpEs
Functional Programming for EcmaScript(Javascript)
Stars: ✭ 40 (-42.03%)
Mutual labels:  reactive, reactive-programming, functional-reactive-programming
Firefly
Firefly is an asynchronous web framework for rapid development of high-performance web application.
Stars: ✭ 277 (+301.45%)
Mutual labels:  reactive, asynchronous, reactive-programming
react-mobx-router5
React components for routing solution using router5 and mobx
Stars: ✭ 58 (-15.94%)
Mutual labels:  reactive, observable, reactive-programming
Rxdownloader
- Reactive Extension Library for Android to download files
Stars: ✭ 40 (-42.03%)
Mutual labels:  reactive, reactive-programming, reactive-extensions
Fpgo
Monad, Functional Programming features for Golang
Stars: ✭ 165 (+139.13%)
Mutual labels:  reactive, reactive-programming, functional-reactive-programming
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (+136.23%)
Mutual labels:  reactive, reactive-programming, reactive-extensions
Mag.js
MagJS - Modular Application Glue
Stars: ✭ 157 (+127.54%)
Mutual labels:  reactive, observable, framework
Marble
Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.
Stars: ✭ 1,947 (+2721.74%)
Mutual labels:  reactive, observable, framework
Redux Most
Most.js based middleware for Redux. Handle async actions with monadic streams & reactive programming.
Stars: ✭ 137 (+98.55%)
Mutual labels:  reactive, reactive-programming, observable
Rx.Book
High level asynchronous programming with Reactive Extensions
Stars: ✭ 67 (-2.9%)
Mutual labels:  asynchronous, reactive-programming, reactive-extensions
Reactor Core
Non-Blocking Reactive Foundation for the JVM
Stars: ✭ 3,891 (+5539.13%)
Mutual labels:  reactive, asynchronous, reactive-extensions
Reactivemanifesto
The Reactive Manifesto
Stars: ✭ 542 (+685.51%)
Mutual labels:  reactive, asynchronous, reactive-programming

Reactive extensions library for Julia

Documentation Build Status

Rocket.jl is a Julia package for reactive programming using Observables, to make it easier to work with asynchronous data.

In order to achieve best performance and convenient API Rocket.jl combines Observer pattern, Actor model and Functional programming.

Inspired by RxJS and ReactiveX communities.

Rocket.jl has been designed with a focus on performance and modularity.

The essential concepts in Rocket.jl are:

  • Observable: represents a collection of future messages (data or/and events).
  • Actor: is an object that knows how to react on incoming messages delivered by the Observable.
  • Subscription: represents a teardown logic which might be useful for cancelling the execution of an Observable.
  • Operators: are objects that enable a functional programming style to dealing with collections with operations like map, filter, reduce, etc.
  • Subject: the way of multicasting a message to multiple Observers.

Quick start

For a quick start and basic introduction take a look at the demo folder and Quick Start notebook.

using Rocket, Compose, IJulia ; set_default_graphic_size(35cm, 2cm)
function draw_ball(t)
    IJulia.clear_output(true)
    x = -exp(-0.01t) + 1                     # x coordinate
    y = -abs(exp(-0.04t)*(cos(0.1t))) + 0.83 # y coordinate
    display(compose(context(), circle(x, y, 0.01)))
end
source = interval(20) |> take(200) # Take only first 200 emissions

subscription = subscribe!(source, draw_ball)

Alt Text

unsubscribe!(subscription) # It is possible to unsubscribe before the stream ends    
IJulia.clear_output(false);

Documentation

Full documentation is available at BIASlab website.

It is also possible to build a documentation locally. Just execute

$ julia make.jl

in the docs/ directory to build a local version of the documentation.

First example

Normally you use an arrays for processing some data.

for value in array_of_values
    doSomethingWithMyData(value)
end

In Rocket.jl you will use an observable.

subscription = subscribe!(source_of_values, lambda(
    on_next     = (data)  -> doSomethingWithMyData(data),
    on_error    = (error) -> doSomethingWithAnError(error),
    on_complete = ()      -> println("Completed!")
))

At some point of time you may decide to stop listening for new messages.

unsubscribe!(subscription)

Actors

To process messages from an observable you have to define an Actor that know how to react on incoming messages.

struct MyActor <: Rocket.Actor{Int} end

Rocket.on_next!(actor::MyActor, data::Int) = doSomethingWithMyData(data)
Rocket.on_error!(actor::MyActor, error)    = doSomethingWithAnError(error)
Rocket.on_complete!(actor::MyActor)        = println("Completed!")

Actor can also have its own local state

struct StoreActor{D} <: Rocket.Actor{D}
    values :: Vector{D}

    StoreActor{D}() where D = new(Vector{D}())
end

Rocket.on_next!(actor::StoreActor{D}, data::D) where D = push!(actor.values, data)
Rocket.on_error!(actor::StoreActor, error)             = doSomethingWithAnError(error)
Rocket.on_complete!(actor::StoreActor)                 = println("Completed: $(actor.values)")

For debugging purposes you can use a general LambdaActor actor or just pass a function object as an actor in subscribe! function.

Operators

What makes Rocket.jl powerful is its ability to help you process, transform and modify the messages flow through your observables using Operators.

List of all available operators can be found in the documentation (link).

squared_int_values = source_of_int_values |> map(Int, (d) -> d ^ 2)
subscribe!(squared_int_values, lambda(
    on_next = (data) -> println(data)
))

Rocket.jl is fast

Rocket.jl has been designed with a focus on efficiency, scalability and maximum performance. Below is a benchmark comparison between Rocket.jl, Signals.jl, Reactive.jl and Observables.jl.

We test map and filter operators latency in application to a finite stream of integers. Code is available in demo folder:

Rocket.jl vs Reactive.jl

Rocket.jl vs Signals.jl

Rocket.jl vs Observables.jl

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].