5 ms·
I feel like JS needs auto-currying. function greet(greeting, name) { return `${greeting} ${name}` } const greetWithGreetingHello = greet('h
by valty 3y ago
I feel like JS needs auto-currying.
function greet(greeting, name) {
return `${greeting} ${name}`
}
const greetWithGreetingHello = greet('hello')
greetWithGreetingHello('sally')
And this should work with named arguments too.
function greet({greeting, name}) {
...
}
const greetWithGreetingHello = greet({greeting: 'hello'})
greetWithGreetingHello({name: 'sally'})
With named params, curried functions can be read more naturally too.
greetWithGreetingHelloAndWith({name: 'sally'}).
"and with name sally"
- ssnri 3y agothe key idea for me was realizing that variables are really 3 things: value, type, and identifier. A javascript object is like an S-expression if you squint. The subtree nesting is messier.
- veqq 3y agoI'm responding to an unrelated old comment of yours about questioning all assumptions. In Forth, Chuck Moore said local vars are dangerous. Rather, everything should be a global. (However multithreaded Forth implementations do require locals.)