Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
dadkins
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
12 ms
·
91.
▲
by
dadkins
17y ago
I wondered that too. My best guess is that range of signed/unsigned char both fit in signed ints, so there's no ambiguity in promoting them to ints.
92.
▲
by
dadkins
17y ago
I was skeptical about his example of a compiler bug. Take the following similar example: int bar(void) { unsigned x = 1; int y = -1; return x > y; } Surprisingly, the result is always 0, at least on
93.
▲
by
dadkins
17y ago
Yes, it's lazy. The sieve outputs on a channel, which blocks until you read it. It will only generate more numbers as they're consumed. Same thing with the filters.
94.
▲
by
dadkins
17y ago
1960s? C. A. R. Hoare, ``Communicating Sequential Processes,'' Communications of the ACM 21(8) (August 1978), 666-677.
95.
▲
by
dadkins
17y ago
I decided to try to figure it out from this angle. What we have is a random walk where, with probability 0.51 we go forward, and with probability 0.49 we go backward. If we ever reach 10, we quit. I wrote a program to compute the cumulat
96.
▲
by
dadkins
17y ago
Oh you're right, that's the solution. Silly me, the moment I go to a computer to solve the final equation I get it wrong!
97.
▲
by
dadkins
17y ago
Let X be a random variable indicating the number of heads that have come up. After n flips, E[x] = pn, where p = 0.51 in our case. When X >= n/2 + 5, we're up 10 dollars. In other words, we want to find n such that Pr[X < n/2 + 5]