5 ms·
My hello world requires the "bash" framework and is zero bytes. You call it via: echo "hello world"
by bombcar 3y ago
My hello world requires the "bash" framework and is zero bytes. You call it via:
echo "hello world"
- bdhcuidbebe 3y agoI’m intrigued, please share your 100% text compression rate algorithm!
- bombcar 3y agoJust make sure you have a filesystem that can take arbitrary-length filenames! Then you can compress to zero byte file with a very long filename ;)
- bdhcuidbebe 3y agoI guess if you store the filetable in unlimited S3 storage, maybe ;-)
- reilly3000 3y agoTXT records in Route 53 for 100% SLA
- anoncow 3y agoInfinity compression.
- osigurdson 3y agoI once ran gzip and infinite number of times on a text file. I was surprised at the result.
- besnn00 3y agoShould it become idempotent after a certain number of iterations? What were the results?
- Chaosvex 3y agoHe doesn't have the results, yet. He's running it in an infinite number of times. Without actually checking, the result is going to be that the output size increases slightly over time.
- osigurdson 3y agoI was in quantum space at the time so results are hard to translate. The best approximation to our current reality is a black hole.
- tynorf 3y agoI'm pretty sure part of the contract with gzip (and compression in general) is that applying it N times is undone by decompressing N times. The size definitely gets bigger with each iteration: $ echo text >0.txt $ for i in {0..9}; do gzip <$i.txt >$((i + 1)).txt done $ ls | sort -n | xargs -n1 wc -c 5 0.txt 25 1.txt 46 2.txt 69 3.txt 82 4.txt 105 5.txt 120 6.txt 143 7.txt 161 8.txt 184 9.txt 207 10.txt
- mkleczek 3y agoI am afraid it requires "echo" runtime environment, doesn't it?
- tehsauce 3y agoyes but it’s very easy to install if you have npm
- AdieuToLogic 3y agoThat almost launched a sip of morning coffee... Well played!
- hnfong 3y agoecho is actually a bash builtin, so, not really, unless you're using another shell that doesn't have builtin echo.
- virtue3 3y agowhoosh...
- AdieuToLogic 3y agoHow about this, assuming there must be a stand-alone "binary": cd /tmp echo 'echo $0' > hello\ world chmod +x hello\ world PATH=. hello\ world
- osigurdson 3y agoAre you sure that is zero bytes?
- stickfigure 3y ago> echo "hello world" I count 18 bytes in that program. Too long! I left a definitive answer on Quora some years ago: https://www.quora.com/What-programming-language-has-the-shortest-Hello-World-program/answer/Jeff-Schnitzer?ch=10&oid=8795460&share=cf052892&srid=CWe&target_type=answer https://www.quora.com/What-programming-language-has-the-shor...
- deleted 3y ago[deleted]
- sacrosancty 3y agoThose 18 bytes aren't the binary, they're just the command to call the program. Don't count it just as you wouldn't count the length of the filename and its arguments for a regular executable.
- cvoss 3y agoIf you insist on categorizing `echo "hello world"` as the invocation, rather than the program, then what is the program under your categorization? I'll submit that it is the `echo` binary, which is a whopping 35kB on my machine. I'll just observe that there is no way to compress "hello world" below a certain size (definitely not to size 0). If you think you have, you've just "moved" it into, say, the framework/os/input/algorithm/etc. But this fun little debate we're having here is actually connected to some deep theoretical questions, like Kolmogorov complexity, its invariance theorem, and applications to the concept of data compression [0]. [0] https://en.wikipedia.org/wiki/Kolmogorov_complexity https://en.wikipedia.org/wiki/Kolmogorov_complexity
- deleted 3y ago[deleted]
- nighmi 3y agoYou can skip "echo" and let the error message output "hello world" along with extra text!
- tamrix 3y agoMy hello world in php. Requires php. Hello World