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
const zero = F => V => V; | |
const one = F => V => F(V); | |
const two = F => V => F(F(V)); | |
const three = F => V => F(F(F(V))); | |
const add = N => M => F => V => N(F)(M(F)(V)); | |
const multiply = N => M => F => V => N(M(F))(V); | |
const power = N => M => F => V => (M(N))(F)(V); | |
const successor = N => F => V => F(N(F)(V)); |
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
const isAutological = (func, ...funcParams) => { | |
const funcReturnValue = func(...funcParams); | |
return Object.is(funcReturnValue, func); | |
} | |
const isHeterological = (func, ...funcParams) => { | |
return !isAutological(func, ...funcParams); | |
} | |
const anAutologicalFunc = () => anAutologicalFunc; |