Last active
September 28, 2019 16:11
-
-
Save kimdwkimdw/80a7ddbfeec9a15e8f9614cada5f2ac1 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
const r = 3; | |
const comb = [-1, -0.5, 0, 0.5, 1]; | |
let final_combinations = []; | |
( ( (f) => f(f) ) | |
( (f) => (r, v) => { | |
if (r) for (let c in comb) { v.push(comb[c]); f(f)(r-1, v); v.pop(); } | |
else final_combinations.push(v.slice()); | |
} | |
)) | |
(r , []) | |
final_combinations[0]; | |
final_combinations.length; // comb**r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
딱 그런 비슷한게 필요했어서 ㅎㅎ