Knusper

joined 2 years ago
[–] [email protected] 2 points 1 year ago (1 children)

I do composing, too, and I've written my fair share of shoddy scripts to automate tasks, but changing up the whole keyboard layout for a task, that's the sort of madness I aspire to. πŸ™ƒ

[–] [email protected] 1 points 1 year ago

Yeah, I had it on Super+T at first, too, but I have the command/application/everything runner bound to Super+Esc and I open a lot of terminal windows throughout the day, so I re-bound it to Super+R just because it's slightly easier to reach.

[–] [email protected] 13 points 1 year ago

Unused RAM practically does not exist. The OS will use it for disk caching.

[–] [email protected] 5 points 1 year ago

Welp, imma try myself at an explanation. Mostly cause I haven't written Haskell in a while either.

So, that first line:

hanoi :: Integer -> a -> a -> a -> [(a, a)]

...actually only declares the function's type.

In this case, it's a function that takes an Integer and three values of a generic type a and then returns a list of tuples of those same as.
So, those as are just any types representing the towers. Could be strings, integers, custom data types, whatever. The returned tuples represent movements between towers.

Following that are actually two definitions of the function.

The first definition:

hanoi 0 _ _ _ = []

...is the recursion base case. Function definitions are applied, whenever they match, being evaluated top-to-bottom.

This line specifies that it only matches, if that first Integer is 0. It does not care what the remaining parameters are, so matches them with a wildcard _.
Well, and to the right side of the equals sign, you've got the return value for the base case, an empty list.

Then comes the more interesting line, the recursion step:

hanoi n a b c = hanoi (n-1) a c b ++ [(a, b)] ++ hanoi (n-1) c b a

This line matches for any remaining case. Those small letter names are again wildcards, but the matched value is placed into a variable with the provided name.

And then, well, it recursively calls itself, and those ++ are list concations. This line's only real complexity is the usual Tower Of Hanoi algorithm.

[–] [email protected] 7 points 1 year ago* (last edited 1 year ago) (5 children)

Super+F -> Firefox
Super+R -> Terminal
Super+E -> File Manager
Super+X -> Note-taking program

[–] [email protected] 10 points 1 year ago (2 children)
hanoi :: Integer -> a -> a -> a -> [(a, a)]
hanoi 0 _ _ _ = []
hanoi n a b c = hanoi (n-1) a c b ++ [(a, b)] ++ hanoi (n-1) c b a

From here: https://www.rosettacode.org/wiki/Towers_of_Hanoi#Haskell

[–] [email protected] 3 points 1 year ago

I mean, I do get paid for overtime (flexible work hours) and do like to complete tasks before I go into the weekend, but sometimes all your team mates decide to call it a day, and then yeah, I don't care that hard either...

[–] [email protected] 3 points 1 year ago

Yeah, I've developed a habit of writing TODO-comments wherever there's still something unfinished. And well, I usually leave in a compile error to force me to continue exactly there.

[–] [email protected] 2 points 1 year ago

I mean, El NiΓ±o happens every few years. Or are we not talking about the climate phenomenon?

[–] [email protected] 7 points 1 year ago

Completely spitballing here based on your anecdotal observation, but I know that with lactose-intolerance, you're lacking lactase for processing the lactose, so the lactose makes it unprocessed into the gut, where the gut microbiota then process the lactose and cause the usual symptomes.

Well, and those gut microbiota can signal to your brain that they want more of a given food (source).
So, maybe those bacteria in your gut fucking love lactose, because it is basically sugar, and so they instruct you to self-destruct.

[–] [email protected] 3 points 1 year ago

Oh yeah, it does. I'm not really complaining about fixing it myself. Mostly, I was joking that I felt like I'm unneeded. Rust-analyzer actually being able to fix it on its own, doesn't help in that sense either. πŸ™ƒ

view more: β€Ή prev next β€Ί