janAkali

joined 2 years ago
[–] janAkali@lemmy.one 5 points 2 years ago* (last edited 2 years ago) (1 children)

That ad is targeted to Dragons.

[–] janAkali@lemmy.one 4 points 2 years ago

I guess it's just a real handwriting on a note with everything around inpainted.

[–] janAkali@lemmy.one 62 points 2 years ago* (last edited 2 years ago) (14 children)

Yes the compiler/interpreter can figure it out on the fly, that's what we mean by untyped languages.

Are there untyped languages? You probably meant 'dynamically typed languages'.

But even statically typed languages can figure out most types for you from the context - it's called 'type inference'.

[–] janAkali@lemmy.one 3 points 2 years ago (4 children)

I don't understand.
How is it hard to remember: "eXtract File" = "tar xf ..."? If tar is gZipped - it's "tar xzf ...".
I don't think I've ever seen tarball that wouldn't work with one of these two commands.

[–] janAkali@lemmy.one 4 points 2 years ago* (last edited 2 years ago) (2 children)

RunnerUp and Another Activity Tracker seem like your best options.

[–] janAkali@lemmy.one 3 points 2 years ago* (last edited 2 years ago) (1 children)

For one - the error handling. Every codebase is filled with messy, hard to type:

if err != nil {
    ...
}

And it doesn't even give you a stack trace to debug the problem when an error happens, apparently.

Second reason - it lacks many features that are generally available in most other languages. Generics is the big one, but thankfully they added them in last half a year or so. In general Golang's design principle is to implement only the required minimum.

And probably most important - Go is owned by Google, aka the "all seeing eye of Sauron". There was recently a big controversy with them proposing adding an on-by-default telemetry to the compiler. And with the recent trend of enshittification, I wouldn't trust google or any other mega-corporation.

[–] janAkali@lemmy.one 7 points 2 years ago

I have all apps I use daily in the appimage format. Yesterday I decided to try btrfs for my root partition and did my annual Linux reinstall. All my apps were already there and ready for work from the start.
I also have a usb flashdrive always on me with the same appimages. Just in case I'd wipe a hard drive by accident and wouldn't have an internet connection or something like that (in case of emergencies). You can't do this with flatpaks or snaps.

[–] janAkali@lemmy.one 10 points 2 years ago (3 children)

IMO, go's gopher is ugly, not cute. But, anyway, there are better reasons not to learn Go.

[–] janAkali@lemmy.one 2 points 2 years ago* (last edited 2 years ago)

Nim

Part 1 and 2: I solved today's puzzle without expanding the universe. Path in expanded universe is just a path in the original grid + expansion rate times the number of crossed completely-empty lines (both horizontal and vertical). For example, if a single tile after expansion become 5 tiles (rate = +4), original path was 12 and it crosses 7 lines, new path will be: 12 + 4 * 7 = 40.
The shortest path is easy to calculate in O(1) time: abs(start.x - finish.x) + abs(start.y - finish.y).
And to count crossed lines I just check if line is between the start and finish indexes.

Total runtime: 2.5 ms
Puzzle rating: 7
Code: day_11/solution.nim
Snippet:

proc solve(lines: seq[string]): AOCSolution[int] =
  let
    galaxies = lines.getGalaxies()
    emptyLines = lines.emptyLines()
    emptyColumns = lines.emptyColumns()

  for gi, g1 in galaxies:
    for g2 in galaxies[gi+1..^1]:
      let path = shortestPathLength(g1, g2)
      let crossedLines = countCrossedLines(g1, g2, emptyColumns, emptyLines)
      block p1:
        result.part1 += path + crossedLines * 1
      block p2:
        result.part2 += path + crossedLines * 999_999
[–] janAkali@lemmy.one 2 points 2 years ago (2 children)

Nim

I have zero idea how this functions correctly. I fear to touch it more than necessary or it would fall apart in a moment.
I got second star after 8 hours (3 hours for part 1 + 4 hour break + 1 hour part 2), at that moment I've figured out how to mark edges of enclosed tiles. Then I just printed the maze and counted all in-between tiles manually. A bit later I've returned and fixed the code with an ugly regex hack, but atleast it works.
Code: day_10/solution.nim

[–] janAkali@lemmy.one 6 points 2 years ago* (last edited 2 years ago)

Nim

Part 1:
The extrapolated value to the right is just the sum of all last values in the diff pyramid. 45 + 15 + 6 + 2 + 0 = 68
Part 2:
The extrapolated value to the left is just a right-folded difference (right-associated subtraction) between all first values in the pyramid. e.g. 10 - (3 - (0 - (2 - 0))) = 5

So, extending the pyramid is totally unneccessary.

Total runtime: 0.9 ms
Puzzle rating: Easy, but interesting 6.5/10
Full Code: day_09/solution.nim
Snippet:

proc solve(lines: seq[string]): AOCSolution[int] =
  for line in lines:
    var current = line.splitWhitespace().mapIt(it.parseInt())
    var firstValues: seq[int]

    while not current.allIt(it == 0):
      firstValues.add current[0]
      block p1:
        result.part1 += current[^1]

      var nextIter = newSeq[int](current.high)
      for i, v in current[1..^1]:
        nextIter[i] = v - current[i]
      current = nextIter

    block p2:
      result.part2 += firstValues.foldr(a-b)
[–] janAkali@lemmy.one 30 points 2 years ago (2 children)

I love every single game these guys make, but World of Goo is definitely in my top 10 games of all time.
I can't even believe they're making a sequel. It's the dream comes true.
Going to replay the original in 100th time.

view more: ‹ prev next ›