Created
March 3, 2023 01:30
-
-
Save SekiT/20c2d4ebced3ed756f43403294a9798f to your computer and use it in GitHub Desktop.
Cyclic Tag System implementation
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
| function*cts(S,d){for(i=0;d;d=d.slice(1)+['',S[i++%S.length]][d[0]])yield d} | |
| // Example usage | |
| let j=0; for(v of cts(["01", "10"], "11")){ console.log(v); if(++j>=10) break } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Elixir version (without handling empty string):