Last active
December 15, 2016 11:58
-
-
Save bhalash/a61539987c31d71305cce64755c60de6 to your computer and use it in GitHub Desktop.
Numbers to Binary
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 seconds = days => parseFloat(days) * 86400; | |
const milliseconds = seconds => parseFloat(seconds) * 1000; | |
const binary = milliseconds => (milliseconds >> 0).toString(2); | |
function compose(a, b) { | |
return function(c) { | |
return b(a(c)); | |
} | |
} | |
function curry(a, val) { | |
return function(b) { | |
return a(val + b); | |
} | |
} | |
function add(number) { | |
const privateAdd = (a, b) => a + b; | |
return function(n) { | |
return privateAdd(number, n); | |
} | |
} | |
binary(milliseconds(seconds(24.85513481))); // "1111111111111111111111111111111" | |
binary(milliseconds(seconds(22))); // "1110001010010111110100000000000" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment