points by MaulingMonkey 3 hours ago | 0 comments
I prefer:
const size_t n = 10;
for (size_t i = n; i --> 0;) {
std::cout << i << "\n";
}[–] hedgehog 3 hours ago
[–] omoikane 2 hours ago
That looks like the brainfuck mandelbrot set by Erik Bosman, but the example is missing the header line with the credit. The one I saw came from here:
https://github.com/thaliaarchi/bfcorpus/blob/main/ebosman/ma...
Be sure to check out other files in that directory for how the program is assembled.
(Erik Bosman's mandelbrot set is a personal favorite of mine, very useful for benchmarking brainfuck interpreters)
[–] ranger_danger 3 hours ago
Cute but wouldn't work with ssize_t :)
VHDL's array/vector syntax actually works a similar way:
-- gives 0, 1, 2, 3:
for i in 0 to 3 loop
-- gives 3, 2, 1, 0:
for i in 3 downto 0 loop
-- Source - https://stackoverflow.com/a/7642026 -- Posted by Kerrek SB -- Retrieved 2026-10-29, License - CC BY-SA 3.0
[–] fourthark 3 hours ago
Does work with ssize_t, just not necessary.
[–] ranger_danger 2 hours ago
Depends on your definition of "work".
For me it does not work because I'd want to use it with values < 0, but the for loop checks for > 0, so I would have to modify that first.
http://maulingmonkey.com/brainfuck/