Recent submissions

Comment · 4 years ago
Surely it's easier to stick to JavaScript The Good Parts than to introduce a whole new layer in the form of Blazor?
Comment · 4 years ago
The question is very unrealistic... how often do you know there is exactly one duplicate in a list?

Much more common is there are zero or more duplicates.

Here is what I came up with:

- We need a way to record what has been already seen

- A hash-map could work, but I think we can be more efficient

- We know that all elements are less than the array length in size...

- So we can allocate a single array of flags with the same length as the input

- The flag for value `n` is at position `n` in this array

    let findDuplicates xs =
      let seen = Array.create (Seq.length xs) false

      let mutable duplicates = []

      for x in xs do
        if seen[x] then
          duplicates <- x :: duplicates
        else
          seen[x] <- true

      duplicates
I'm pretty sure this is O(n)?

I think it's interesting that the mathematical trick (sum of numbers 1 to n formula) does not work in the more realistic variant. This fact is probably why leet-code problems are so disconnected from the real world. It's like AI for board-games.

Comment · 4 years ago
This is true cyberpunk.
Comment · 4 years ago
No because the metadata on the deleted resource is now lost.

With the information being stored outside the resource, we know that it was deleted and the metadata about it.

Comment · 4 years ago
This strategy would miss some huge and unexpected gains. Tesla comes to mind (at least for the time being...)
Comment · 4 years ago
It's not that GraphQL enables anything that was not possible before; it's that GraphQL provides a bit more structure and standardization around these things. If you plan to do this stuff, why not follow something with a spec and various bits of tooling rather than doing it ad-hoc?
Comment · 4 years ago
The problem is Bitcoin Core may have (will have) unknown vulnerabilities and those might not get patched correctly once discovered.
Comment · 4 years ago
That can be desirable but there are a few challenges:

- The compiler code becomes more complicated, making correctness harder

- The compiler might become slower to run

- Introducing new languages features may become harder, again due to code complexity

Comment · 4 years ago
Websites will get updated pretty damn fast if everyone has them disabled.
Comment · 4 years ago
Here's an idea for the EU: mandate that all major browsers ship with third-party cookies disabled by default and drop the whole cookie-banner nonsense.
Comment · 5 years ago
Wait, it's not about game development??
Comment · 5 years ago
A significant burden is actually the lack of regulatory alignment. Before Brexit there was a largely customs-check free flow of goods in and out of the EU. Now we have more delays and paperwork. This is not a tariff, but it imposes costs like one.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton