1. 15

  2. 5

    I like how Ruby is only 10 bytes without any special tricks.

    1. 5

      The question is not How but 35WY

      1. 3

        Why does the C function f execute? Doesn’t it have to be called main?

        1. 3

          The “Try it Online!” link shows that they are stuffing main into a “footer” https://tio.run/##S9ZNT07@/z/TOk1Ds1pXN1NNLU2jOCc1tUDDXFPTuvZ/bmJmHlAGKAvkAAA

          seems to go against the spirit of the whole thing. :)

          1. 2

            Maybe it has to be compiled with -Df=main? It seems like cheating though.

            1. 2

              I think the fact that it won’t work without a separate main() to call it is legal under the rules because the rules as posted say “Make a program or function which …” rather than “Make a program which …”

              Tbh I think restricting it to programs would be more interesting and align better with the original intent.

            2. 2

              It would be funny if one of these running processes was all that could be salvaged after the collapse of civilzation.

              1. 2
                // If we sleep for i from 0 to X, we'll be sleeping for N = (X**2) / 2 (draw it as a graph, you get a right triangle, find the area of the triangle)
                // we want to sleep 31557600000000 milliseconds
                // Solve for X, X = sqrt(2N) = 7944507.53666
                // Error check: ((7944507**2) / 2) / 31557600000000 = 0.999999
                // 56 characters
                fn main(){for x in 0..7944507{std::thread::sleep_ms(x)}}

                Annoyingly, about 21 of the characters is std::thread::sleep_ms. I have no idea how to do this with a busy loop reliably in a way that would be shorter (std::time is pretty long, too).