question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

To make it easier to use the reducer pattern in Cycle.js apps, we could implement a .apply() operator, that takes a stream of functions and an initial value and does stream.fold((value, function) => function(value), initialVal). You could define this very trivially on your own, but I feel that it would do better in the core.

Thoughts?

(P.S this is the 100th issue 🎉 )

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Hypnosphicommented, Aug 7, 2016

delay(period) is stream.map(v => xs.periodic(period).take(1).mapTo(v)).compose(flattenConcurrently()) debounce(period) is stream.map(v => xs.periodic(period).take(1).mapTo(v)).flatten() concat(stream1, stream2) is xs.merge(stream1, stream1.last().mapTo(stream2).flatten())

0reactions
ghostcommented, Aug 10, 2016

@Hypnosphi Interesting. Those are pretty complex to write and understand though, so maybe @staltz has a point there. Because this is so simple to define on your own, maybe it’s not worth putting it in core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function.prototype.apply() - JavaScript - MDN Web Docs
The apply() method calls the specified function with a given this value, and arguments provided as an array (or an array-like object).
Read more >
JavaScript Function apply() Method - W3Schools
The apply() method takes arguments as an array. The apply() method is very handy if you want to use an array instead of...
Read more >
SQL Server CROSS APPLY and OUTER APPLY
The APPLY operator allows you to join two table expressions; the right table expression is processed every time for each row from the...
Read more >
JavaScript apply() Method By Practical Examples
THe apply() method is similar to the call() method except that it takes the arguments of the function as an array instead of...
Read more >
Why override operator()? - c++ - Stack Overflow
One of the primary goal when overloading operator() is to create a functor. A functor acts just like a function, but it has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found