Questions tagged [frp]

Functional reactive programming is programming paradigm for reactive programming

441 questions
0
votes
1 answer

continuously loop through values in an array using Baconjs

I have an array of strings var strs = ['a','b','c'] and I want to use a Bacon.interval(2000) to return the values continuously to onValue The closest thing I can think of to create this is var stream = Bacon.interval(2000); var i =…
andykais
  • 665
  • 1
  • 6
  • 18
0
votes
2 answers

Wait for latest values from dependent streams in BaconJS?

I have 3 streams. gradingResult and contextId depend on studentResponse. I need to fire an event and only one event (otherwise, this is trivial) when all 3 have the latest values. I've tried #combineTemplate and #sampledBy studentResponse.…
U Avalos
  • 5,553
  • 6
  • 38
  • 67
0
votes
1 answer

Handle two signals the same way in ReactiveCocoa

Let's say I have two signals textField1Signal |> map { value in return value.lowercaseString } |> on ( next: { value in println("textField1 changed to \(value)"); } ) textField2Signal |> map { value in return…
matteok
  • 1,903
  • 3
  • 26
  • 44
0
votes
1 answer

Getting filter and map chaining to work on ReactiveCocoa 3.0 beta swift

secondTextField.rac_textSignal() .map { (value: AnyObject!) -> Int in let textFromField = value as! NSString return textFromField.length **line }.filter { (filter: AnyObject!) -> Bool in let…
Terry Bu
  • 859
  • 1
  • 13
  • 29
0
votes
2 answers

The ability to create Doc element of hypertext in Websharper.UI.Next

I have the string with html markup, an I want to cretae Doc elment from it like this: Doc.FromHtm "

.....

.....
" As I understand that this is not possible right now. Ok, what is not possible to accurately sew, I tried to roughly…
fpawel
  • 249
  • 3
  • 11
0
votes
1 answer

Implement Pan Gesture Interface Using ReactiveCocoa

Let's say I have a view that I want to be draggable. Using just UIKit I would implement that with a variation of the following logic. var viewStartY: CGFloat = 0 var panStartY: CGFloat = 0 func handlePan(recognizer: UIPanGestureRecognizer) { …
matteok
  • 1,903
  • 3
  • 26
  • 44
0
votes
1 answer

Print result from reduce in Highland.js

I written a simple script which should count line var H = require('highland'), fs = require('fs'), split = require('split'); var lineStream = fs.createReadStream('data-samples/sample.log').pipe(split()); H('data', lineStream).reduce(0,…
kharandziuk
  • 9,273
  • 9
  • 51
  • 94
0
votes
1 answer

Never running stream Bacon.js. Callback never calls

I am trying to use Bacon stream as never ending loop but it doesn't work. var Bacon = require('baconjs'); var INTERVAL = 300; var tickStream = Bacon.interval(INTERVAL); var isMaster = tickStream.flatMap(function() { console.log('I never see the…
kharandziuk
  • 9,273
  • 9
  • 51
  • 94
0
votes
1 answer

emit items only if the last value of another observable meets a condition

I need to implement an observable that would ask to load data only if it's not already being loaded. I was thinking of having two observables: one for load requests and another for loading state. I'm not sure if the following scenario is possible…
midnight
  • 3,385
  • 3
  • 32
  • 57
0
votes
1 answer

Netwire 5 - A box cannot bounce

I am trying to convert challenge 3 ( https://ocharles.org.uk/blog/posts/2013-08-01-getting-started-with-netwire-and-sdl.html ) from netwire 4.0 to netwire 5.0 using OpenGL. Unfortunately, the box cannot bounce. The entire code is following. It seems…
0
votes
1 answer

How do I get the currenct value of a property?

First entry in the FAQ... There is no getLatestValue method available and will not be either. You get the value by subscribing to the stream/property (using onValue) and handling the values in your callback What if I'm not ready for the value at…
Ian Warburton
  • 13,336
  • 19
  • 85
  • 164
0
votes
1 answer

BaconJS Directory Structure Recursion Example

I'm just starting out on FRP and baconjs, so forgive my ignorance on terminology. I am on a project where I'm trying to create a directory structure within google drive. I need to ensure the parent directories are created prior to the children…
Patricia M
  • 15
  • 3
0
votes
1 answer

Creating a form with Elm

I would like to create a form in Elm that takes 4 required inputs: 3 floating point values 1 input which can take the values of "long" or "short" (presumably) this would be a drop-down When the values are entered, a computation occurs that yields…
Terrence Brannon
  • 4,008
  • 5
  • 32
  • 59
0
votes
1 answer

flattenMap and error handling in ReactiveCocoa with swift

After reading the following tutorial http://www.scottlogic.com/blog/2014/07/24/mvvm-reactivecocoa-swift.html I am trying to use ReactiveCocoa with Swift with in of my apps. When button is pressed I am making a request to check if server is…
pawurb
  • 496
  • 6
  • 18
0
votes
1 answer

How can I split a signal and merge it in again later?

I'm not quite sure how to do this correctly, and I'm probably missing some notions of FRP since I've not long been playing with ReactiveCocoa. My situation is this - I have signals which: loads an object from a local store; loads an object from a…
Rupert
  • 1,977
  • 15
  • 27