Created
June 27, 2018 04:44
-
-
Save johntran/048a993fb1e1500781cca196fac4ba01 to your computer and use it in GitHub Desktop.
Programs are just generalized polynomials
This file contains hidden or 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
// Exponential Laws | |
// B^(x+y) = B^x * B^y | |
// B^(x*2) | |
function addTimeOrTemp(x, isTime) { | |
if (isTime) { | |
this.time += x; | |
return this.time; | |
} else { | |
this.temp += x; | |
return this.temp; | |
} | |
} | |
// B^(x+y) | |
function addTimeOrTemp(x) { | |
switch (x) { | |
case typeof x === 'Time': { | |
this.time += x; | |
return this.time; | |
} | |
case typeof x === 'Temp': { | |
this.temp += x; | |
return this.temp; | |
} | |
} | |
} | |
// B^x * B^y | |
function addtime(x) { | |
this.time += x; | |
return this.time; | |
} | |
function addTemp(x) { | |
this.temp += x; | |
return this.temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment