9,664 karma · joined Jun 14, 2010 (16y ago) · 1,504 submissions
comment 6y ago · link · parent
The other way would be if the king itself moves. If the king moves onto a square with an opposing rook and a queen, and decides to capture the rook, the king is trapped until the queen moves. In this scenario, the queen must have moved there in the last turn, putting the king in check. Maybe that’s a new way to get a stalemate.
comment 6y ago · link · parent
comment 6y ago · link · parent
I think the real issue is that “reversing text” is fundamentally an operation that only makes sense in Western alphabets — the complexities of Unicode just reflect that. This is a bit hard to fathom for people who grew up with such an alphabet (this includes me), where there’s a rich tradition of games based on shuffling letters. It’s not just reversing; my understanding is that you can’t meaningfully define the concept of an anagram in many writing systems.
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
So maybe the user experience hierarchy goes something like: great SPA > MPA > average SPA?
This would mean there’s still a place for MPAs, at least with certain budget constraints.
comment 6y ago · link · parent
comment 6y ago · link · parent
AFAICT, the only real changes are in (new) line 411, resetting the cp variable after the loop, and line 416, ignoring write errors. The former is probably the relevant one.
comment 6y ago · link · parent
I agree with the GP‘s point that static typing forces you to do that kind of design work earlier.
(Edit: You raise a good point, though. I think a lot of people run into this kind of problem with static typing.)
comment 6y ago · link · parent
Of course it’s possible to go too far the other way, and R5RS leaves too many questions unanswered. But in my opinion, simplicity is also an important feature, not just academically, but in practice.
comment 6y ago · link · parent
In total, I find it hard to deny how productive the NPM ecosystem can be, despite my philosophical objections to the way the community is run. Am I crazy here?
comment 6y ago · link · parent
Take something like getStrLn (which reads a line from STDIN). What is "getStrLn", as a mathematical object? It's not a string, rather, it's some kind of "I/O operation" that when executed, returns a string. Haskell calls such an object an "IO String". Similarly, the expression (putStrLn "foo") is an I/O operation that when executed, doesn't return anything. Haskell calls this an "IO ()".
Once you develop an intuition of I/O operations, you can see how you might want to combine atomic I/O operations into larger and larger I/O operation, feeding the output from one as input into the other. Or how you could treat a plain Int as an "empty" I/O operation that when executed, simply returns the Int. And how your entire program, its "main" entry point, can be modeled simply as one large I/O operation.
You can do all of that, and write every possible kind of I/O code in Haskell, without ever learning about monads.
What are monads for, then? They generalize the structure of this approach, with its (>>=) and return operators, and apply it to other cases that don't have anything to do with I/O. But this step is completely optional! This is very similar to how the idea of a mathematical "field" generalizes the arithmetic operators (+, -, *, /) and applies them to objects that don't look anything like the rational numbers. You don't have to learn about fields to successfully use rational numbers. And we would never dream of explaining the abstract idea of fields to people before we introduce them to rational numbers. Yet almost every I/O tutorial in Haskell begins with a half-baked explanation of monads.
comment 7y ago · link · parent
However, that's at the OS level. What can realistically be done at the hardware level? It must be possible in theory to design a CPU that's better at this kind of context switching, but I don't know if a new "computer company" really wants to go there.
comment 7y ago · link · parent
Additionally, starting from the inside allowed for physically smaller disc formats without any special software support: https://en.m.wikipedia.org/wiki/Mini_CD
I don’t know for sure if that possibility was part of the original design. But it must have been introduced somewhat early, given that every CD player tray I’ve ever seen has that extra ridge to hold the smaller discs in place.
comment 7y ago · link · parent
Yes, the response is technically correct. But...
comment 7y ago · link · parent
The context of the discussion was cpuguy83's suggestion that compared to AMD, Intel has been "suffering from shortcuts leading to Spectre/Meltdown and the performance regressions due to patching those".
cpuguy83's comment was very concise, so let me elaborate that the distinction between Spectre and Meltdown is essential here. Both are security flaws in CPUs that were published at the same time. Spectre is an industry-wide problem that also hit AMD, but "Meltdown" is the result of an Intel-specific implementation choice that I think one might fairly describe as a "shortcut". (Even IshKebab later agrees: https://news.ycombinator.com/item?id=21342048) Meltdown was also more immediately dangerous, and the software workarounds that were necessary to mitigate it in existing CPUs cost a lot of performance.
Given this context, I'll quote the relevant item from cpuguy83 again and then IshKebab's reply:
> cpuguy83: Intel [... has been ...] suffering from shortcuts leading to Spectre/Meltdown and the performance regressions due to patching those.
> IshKebab: AMD chips suffer from Spectre too (which is the hard to fix issue). They didn't really take any fewer "shortcuts" than Intel. And they weren't "shortcuts".
Note how IshKebab carefully ignores the Meltdown part of cpuguy83's comment to be able to claim that Intel hasn't been doing any worse than AMD, and that there were no shortcuts. For Spectre in the stricter sense, that's technically true. It's not true in the context of the entire Spectre/Meltdown event, which was cpuguy83's argument.
comment 7y ago · link · parent
I think that’s misleading or even wrong. Source: native speaker.
First, it’s a very rare word that would definitely stand out, even in an already formal conversation. More importantly, “diffizil” is mostly reserved for problems that require a lot of fine motor skills or finesse. It would be wrong to say that lifting some large boulder is “diffizil”, for example, except as a joke. You might use it for repairing a watch or a complicated negotiation (“eine diffizile Angelegenheit”), however.
comment 7y ago · link · parent
comment 7y ago · link · parent
> First check the remainder modulo 10, modulo 9 and modulo 24.
This makes zero sense already. First, 9=3 x 3, so checking for 3 is sufficient. (Checking for 9 might be easier in decimal, but why the hell would you do cryptography in decimal?) Then there’s the 24=2 x 2 x 2 x 3. Again, why not just use 6, but even worse, there’s no new factor here that’s not already covered by 10 and 9.
(And as you mentioned, even if this works, much better primality Tests are readily available.)
(Off-topic: Is there a good way to indicate multiplication on HN? I can’t figure out how to escape asterisks, and Unicode symbols seem to be simply filtered out, which is a bit crazy in 2019.)