标签:ted OLE cti mod java UNC sed seve javascrip
function eq (y) {
return function forX(x) {
return x === y
}
}
function mod (y) {
return function forX (x) {
return x % y
}
}
function compose (fn2, fn1) {
return function composed (val) {
return fn2(fn1(val))
}
}
function not (fn) {
return function negated (...args) {
return !fn(...args)
}
}
isOdd = compose(
eq(1),
mod(2)
)
isEven = not(isOdd)
let fiveIsOdd = isOdd(5)
let fourIsEven = isEven(4)
console.log(`5 is odd ${fiveIsOdd}`)
console.log('4 is even', fourIsEven)
标签:ted OLE cti mod java UNC sed seve javascrip
原文地址:https://www.cnblogs.com/byxxw/p/11323581.html