csp-ksh
Experiments in CSP after reading:
- http://jlongster.com/Taming-the-Asynchronous-Beast-with-CSP-in-JavaScript
- http://phuu.net/2014/08/31/csp-and-transducers.html
You probably shouldn't use this. Although there are tests, I don't fully understand CSP / transducers yet!
Then I also read:
- http://simplectic.com/blog/2014/transducers-explained-1/
- http://jlongster.com/Transducers.js--A-JavaScript-Library-for-Transformation-of-Data
Supports:
- transducers
- buffer strategies: Sliding, Dropping, Fixed
Does not require generators!
Examples
See test.js. Otherwise here's an example of finding the mouse vector:
var td = ;var csp = ;var chan = cspchan;var put = cspput;var take = csptake; // Create a channel with a buffer of size 2 using a sliding window strategy,// with a transducer that groups as tuples.var ch = ; // Built without generators, so we need our own "event loop". { } // Always put the newest event into the channel.documentbody
Why?
Wanted to play around, also wanted to see how small (yet practical) I could make it, transducers and all. Generators are obviously possible via transpilation, but this provides a test bed for playing around in an environment without them.
License
MIT