Created
January 17, 2019 09:44
-
-
Save ysmood/ed1d6e7f29e8e6ddf02b0d790bb83227 to your computer and use it in GitHub Desktop.
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
let inc = n => ++n | |
let dec = n => --n | |
function add (x, y) { | |
if (y < 0) return add(dec(x), inc(y)) | |
if (y === 0) return x | |
if (y > 0) return add(inc(x), dec(y)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment