Recent submissions

Comment · 1 year ago
There are shorter options in Nim too, depending on your stylistic preferences

    let sorted = entries.sorted(proc (a, b: Entry): int = cmp(a.timestamp, b.timestamp))
    let sorted = entries.sorted((a, b) => cmp(a.timestamp, b.timestamp))
    let sorted = entries.sortedByIt(it.timestamp)
I suppose you could change the whole proc to something like

    proc groupIntoThreads(entries: seq[Entry], threshold: int): seq[seq[Entry]] =
      let sorted = entries.sortedByIt(it.timestamp)

      for i, entry in sorted:
        if i == 0 or entry.timestamp - sorted[i - 1].timestamp > threshold:
          result.add(@[sorted[i]])
        else:
          result[^1].add(sorted[i])
Comment · 1 year ago
Comment · 2 years ago
I think a lot of people here are being confused by all the talk about "implicit interfaces" in the article. It's not actually talking about interfaces in C# at all, just about the old-fashioned way of passing callbacks.

If you consider that a problem, you would also have the same problem in any other language with first class functions. Someone might define a `readSomething(string -> int) -> ...` function. Does that mean everyone who now defines a `string -> int` function must make it suitable for `readSomething`? Obviously not. It's up to the caller to pass correct arguments to the functions they are calling.

Comment · 2 years ago
It seems to just be the landing page that's down. The course pages themselves still work.
Comment · 2 years ago
The Java course (https://java-programming.mooc.fi/) was being updated every year until a couple years ago when they switched to Python. I did it in 2020 and it was certainly a good introduction to programming. I don't know about the new Python edition.

Their web development course is also very good: https://fullstackopen.com/en/

Comment · 3 years ago
Images can also be turned off under "Text & Images" in the settings.
Comment · 3 years ago
You could just build the example in C#, grab all the required dlls from it and then load them in PowerShell with `Add-Type -Path '.\QuestPDF.dll'`.

Unfortunately it looks like this uses extension methods for everything, and those are a pain to use in PowerShell. You'll probably want to write the PDF creation bits as a C# cmdlet instead.

Comment · 3 years ago
What did you find fishy about them? They seem roughly the same, aside from the countries involved with the projects having a bit more local information.
Comment · 3 years ago
They don't. What aidenn0 said applies to all CL implementations, although with a small correction that it's not "any already compiled forms", but rather any variables/objects that already hold the value of `#'foo` that will keep pointing to the old definition. Compiled code calling `(funcall #'foo ...)` will get the new definition normally (unless `foo` is inlined).
Comment · 4 years ago
> If a significant advance in charging connectors is made, they can simply amend the law.

Also, I'm not sure what the Indian law says, but at least the EU version actually requires review of current technologies every 5 years.

Comment · 4 years ago
Comment · 4 years ago
> And I still don’t know what the Sampo is!

No one does. Sampo is basically just a magical MacGuffin that brings wealth to whoever has it. In Kalevala it is usually understood as a mill that creates infinite grain, salt and money, but different folk stories have different interpretations.

Comment · 4 years ago
Less work than trying to add named stacks to bash. If it's so central to your workflow that you're willing to put up with the rest of bash just for it, adding a couple lines to your profile can't be that big of a deal.
Comment · 4 years ago
Just get the 7th path from `Get-Location` and `Set-Location` there, e.g.

  function Set-StackLocation ($Position) {
    (gl -Stack).Path | select -Index $Position | cd
  }

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton