Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I also came to a solution very similar to the sibling comment here. I'd love to see why this doesn't work server-side but does work on my machine. What other tests are you running aside from checking each decrement is correct?


Show me your code, that you think is correct, and the server rejects.

I'll tell you what's wrong with your code.


Might I recommend appropriate debugging output? It would save the mystery and back and forth. Not everyone who uses your site has access to you on HN. :)

    func below(n uint64, to chan uint64) {
        for ; n >= 0; n-- {
            var t = n - 1
            to <- n
        }
        close(to)
    }
I've run this locally with to <- n replaced with a print statement and it works with unsigned integers.


Did you make other changes besides `to <- n` becoming print? Because as it stands, that will still produce an infinite loop.


Oh, yes. The for loop init should be "; n > 0; n--"




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: