Skip to content

Instantly share code, notes, and snippets.

@johntran
Created June 27, 2018 04:44
Show Gist options
  • Save johntran/048a993fb1e1500781cca196fac4ba01 to your computer and use it in GitHub Desktop.
Save johntran/048a993fb1e1500781cca196fac4ba01 to your computer and use it in GitHub Desktop.
Programs are just generalized polynomials
// 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