Last active
January 31, 2026 02:50
-
-
Save adntaha/0e39261e6f43d98cc8143b6646f7b84a to your computer and use it in GitHub Desktop.
had fun using recursive programming and set theory to mathematically define integers. unsurprisingly, the amount of brackets grows according to 2^n starting at 0.
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
| >>> int_as_set = lambda n: [int_as_set(i) for i in range(n)] | |
| >>> set_to_str = lambda s: "{" + ", ".join(set_to_str(e) for e in s) + "}" | |
| >>> set_to_str(int_as_set(6)) | |
| '{{}, {{}}, {{}, {{}}}, {{}, {{}}, {{}, {{}}}}, {{}, {{}}, {{}, {{}}}, {{}, {{}}, {{}, {{}}}}}, {{}, {{}}, {{}, {{}}}, {{}, {{}}, {{}, {{}}}}, {{}, {{}}, {{}, {{}}}, {{}, {{}}, {{}, {{}}}}}}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment