Skip to content

Instantly share code, notes, and snippets.

@kimdwkimdw
Last active September 28, 2019 16:11
Show Gist options
  • Save kimdwkimdw/80a7ddbfeec9a15e8f9614cada5f2ac1 to your computer and use it in GitHub Desktop.
Save kimdwkimdw/80a7ddbfeec9a15e8f9614cada5f2ac1 to your computer and use it in GitHub Desktop.
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
@ducky-hong
Copy link

y combinator μΈκ°€μš”? πŸ˜ƒ

@kimdwkimdw
Copy link
Author

λ”± 그런 λΉ„μŠ·ν•œκ²Œ ν•„μš”ν–ˆμ–΄μ„œ γ…Žγ…Ž

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment