What is transduce
? What is it for? This document is intended to help people (such as myself) who would be looking through the ramda docs, find transduce
and have no idea if it would be a good fit for my current problem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A function that takes a number and returns a Promise for nothing but | |
// some logging side effects. | |
const vow = num => new Promise(resolve => { | |
console.log(`start ${num}`); | |
setTimeout(() => { | |
console.log(`done ${num}`); | |
resolve(); | |
}, Math.random() * 500); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mkFuture = v => Future((reject, resolve) => { | |
console.log(`start: ${v}`); | |
setTimeout(() => { | |
console.log(`resolve: ${v}`) | |
resolve(v); | |
}, Math.random() * 1000); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mkFuture | |
// :: Any next | |
// -> Any prev | |
// -> Future next | |
let mkFuture = next => prev => Future((reject, resolve) => { | |
console.log(`start: ${prev},${next}`); | |
setTimeout(() => { | |
console.log(`resolve: ${prev},${next}`) |