├── README.md ├── code ├── 1def qsort(arr){COL} ├── 2__if len(arr) {LT}= 1{COL} ├── 3____return arr ├── 4__else{COL} └── 5____return qsort([x for x in arr[1{COL}] if x{LT}arr[0]]) + [arr[0]] + qsort([x for x in arr[1{COL}] if x{GT}=arr[0]]) ├── compiler.py ├── proof.PNG ├── proof2.png └── proof3.png /README.md: -------------------------------------------------------------------------------- 1 | 0byte 2 | ===== 3 | 4 | Demonstration of a revolutionary language that allows for any arbitrary program to be written without taking up any memory 5 | 6 | The demonstration shows an implementation of Quicksort which takes up no memory 7 | 8 | File Numbering Scheme 9 | ================== 10 | 11 | This is a common problem with long programs (over 10 lines) where the ordering of lines can cause errors due to the numbering of files. This is the correct procedure for numbering files: 12 | 13 | 1. Estimate the maximum number of lines in your code, call it x 14 | 2. Now find log base 10 of x, call that y 15 | 3. Now round down y, call that z 16 | 4. Now find 10 to the power of z 17 | 5. Start counting the lines of code from the number z 18 | 19 | Example - if you guess your code will have 60 lines, start counting at 10. 20 | 21 | 22 | Proof 23 | ===== 24 | 25 | ![Proof](https://raw.github.com/MarkDunne/0byte/master/proof.PNG) 26 | 27 | ![Proof](https://raw.github.com/MarkDunne/0byte/master/proof2.png) 28 | 29 | ![Proof](https://raw.github.com/MarkDunne/0byte/master/proof3.png) 30 | 31 | Featured on http://www.reddit.com/r/shittyprogramming 32 | -------------------------------------------------------------------------------- /code/1def qsort(arr){COL}: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/code/1def qsort(arr){COL} -------------------------------------------------------------------------------- /code/2__if len(arr) {LT}= 1{COL}: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/code/2__if len(arr) {LT}= 1{COL} -------------------------------------------------------------------------------- /code/3____return arr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/code/3____return arr -------------------------------------------------------------------------------- /code/4__else{COL}: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/code/4__else{COL} -------------------------------------------------------------------------------- /code/5____return qsort([x for x in arr[1{COL}] if x{LT}arr[0]]) + [arr[0]] + qsort([x for x in arr[1{COL}] if x{GT}=arr[0]]): -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/code/5____return qsort([x for x in arr[1{COL}] if x{LT}arr[0]]) + [arr[0]] + qsort([x for x in arr[1{COL}] if x{GT}=arr[0]]) -------------------------------------------------------------------------------- /compiler.py: -------------------------------------------------------------------------------- 1 | import sys 2 | from os import listdir 3 | 4 | def toPythonString(str): 5 | str = str.replace('_', ' ').replace('{COL}', ':').replace('{LT}', '<').replace('{GT}', '>') 6 | return str[1:] + '\n' 7 | 8 | code = map(toPythonString, sorted(listdir('code'))) 9 | 10 | with open('out.py', 'w') as outFile: 11 | outFile.writelines(code) 12 | 13 | import out 14 | print out.qsort([3, 2, 1]) 15 | -------------------------------------------------------------------------------- /proof.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/proof.PNG -------------------------------------------------------------------------------- /proof2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/proof2.png -------------------------------------------------------------------------------- /proof3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarkDunne/0byte/7041b9ea4835a4d57872d8b7bc9dde68b9fcfce4/proof3.png --------------------------------------------------------------------------------