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.
const I = x => x | |
const K = x => y => x | |
const A = f => x => f (x) | |
const T = x => f => f (x) | |
const W = f => x => f (x) (x) | |
const C = f => y => x => f (x) (y) | |
const B = f => g => x => f (g (x)) | |
const S = f => g => x => f (x) (g (x)) | |
const S_ = f => g => x => f (g (x)) (x) | |
const S2 = f => g => h => x => f (g (x)) (h (x)) |
#!/bin/bash | |
sudo apt-get install git bc | |
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt | |
sudo mkdir /var/www/letsencrypt | |
sudo chown www-data /var/www/letsencrypt |
const id = '__JUNK__'; | |
// Public key need to be in PKCS8 format | |
// ssh-keygen -e -m PKCS8 -f id_rsa.pub > id_rsa.pkcs8 | |
const publicKey = fs.readFileSync(path.join(__dirname, 'id_rsa.pkcs8'), { encoding : 'utf8' }); | |
const privateKey = fs.readFileSync(path.join(__dirname, 'id_rsa'), { encoding : 'utf8' }); | |
// Sign | |
const signer = crypto.createSign('RSA-SHA512'); | |
signer.update(id); | |
const signature = signer.sign(privateKey, 'hex'); |
CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.
In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.
First, let's illustrate the 3 styles by implementing
None of the string methods modify this
– they always return fresh strings.
-
charAt(pos: number): string
ES1Returns the character at index
pos
, as a string (JavaScript does not have a datatype for characters).str[i]
is equivalent tostr.charAt(i)
and more concise (caveat: may not work on old engines).