Skip Navigation

Posts
0
Comments
205
Joined
3 yr. ago

  • It's very different. You have to come at problems in a very different way because the tools at your disposal are not what you're used to.

    The language itself is quite elegant and simple, if you strip it down to its essence it's basically "when you see A on the left side of the equals sign, replace it with B on the right side of the equals sign" repeated until your program has either errored out or been boiled down to a single value. The type checker ensures that the replacement will be legal no matter what's happening at runtime, and can really help with getting things lined up just right because it's very thorough.

    The simplicity also leads to complexity, though, for a few reasons. The solution to any problem is usually generalizable, since there's such a small surface area to the language itself and the type system allows for very abstract declarations of what a thing does, which leads to very beautiful solutions that are also so general and reusable that it can take work to figure out "okay, so this thing composes one function that is traveling recursively down the list of pairs, applying this function to the first item, and that's composed into this other function that is pulling them apart into separate lists..." whereas if it had been written the "dumb" way it'd be more like "oh, we're breaking these items into two lists and tweaking the first item as we go," unnecessarily tied to the one particular scenario and totally unusable anywhere else in your code, but also more readable and concrete. There's an entire vocabulary of functions that do abstract things that you have to learn to make sense of what's going on sometimes.

    Related to that is monads, which are such a common pattern in Haskell that the language has special notation for them; they're an incredibly powerful tool for putting values in a context and/or creating an environment where background details can be handled out of sight, but they're also so generalizable that they span from the simplest monad that basically just captures "this thing might not actually exist" all the way to the IO monad which, in a way, represents the entire universe, or at least your entire computer. Learning Haskell means wrapping your mind around them, which isn't impossible, they're actually quite simple, basically just 2 functions that need to follow a few rules, but it takes a few examples and explainers to really get it.

    Generally I think any programmer benefits from at least trying out something like Haskell, even if you never become an expert or use it day-to-day, it'll give you a new angle to think from and could spark thoughts you never would have had before.

  • I think Haskell would be a good choice. It's mature, used for real things (amongst a particular crowd, at least) and it's emphatic about being purely functional. Even when it is forced to enable other styles like imperative, it's done in a way that's syntactic sugar for a pure version (do notation being a great example of this, it's really just a chain of lambdas). You can do functional style programming in a lot of languages now, but they'll also let you mix and match other styles, which can make it easy to "cheat." Haskell will teach you functional programming and that's it.

    Also, since it sounds like you're familiar with Rust, it uses a lot of ideas from Haskell. Rust enums are a clone of Haskell's algebraic data types, patterns are almost exactly the same, traits are typeclasses right down to the fact that the compiler can derive some common ones automatically, Rust strongly encourages immutability while Haskell basically requires it, and in both languages you're only allowed to break the rules if you start using things with the word unsafe in them. My experience learning Rust was "oh, C and Haskell had a baby named Rust, cool!" The big difference is that in Rust, you're programming from inside a C-style computer with RAM, while in Haskell you're programming in a mathematical void and the computer is tidily packed away in a box labeled IO.

    A fun guide for learning Haskell is here: https://learnyouahaskell.github.io/

  • It's not undoing the division, it never happens in the first place. Remainders aren't ever fractions, that's the whole point, they're left over because they can't be divided evenly. 5 % 2, you can take 2 away twice and you'll have 1 left over which can't have 2 taken away.

  • (_|_)

  • Happily, Minnesota does not collect this information. In primaries, you get a ballot with all the parties on it, you pick one to fill out and leave the rest blank.

  • No, a lot of information about elections is actually public. Who you vote for is very secret, but your name, address, and the fact that you did or did not vote is often either public or available on request. This is important because if it was just a totally secret thing, there's not much stopping a corrupt election official from dumping as many fake ballots into the total as they like or filling out ballots for people that didn't show up.

  • A minimal but powerful language can feel like magic. Like, literally. The whole appeal of magic in stories is that you can step out of the normal rules and do something that defies belief, and who hasn't fantasized about that in real life?

    If the language you're using has a lot of magic built into it, things that the language can do but you can't do, you feel mundane, like the language is letting you look at the cool things it can do, but doesn't let you do them yourself. A more minimal language, where the important things are in the library, means that the language designers haven't kept that stuff to themselves. They built the language such that that power is available to everyone. If the language gives its standard library authors the power to do things beautifully and elegantly without special treatment, then your library is getting those benefits too.

    It's also a sign of good design, because just saying "well, this thing magically works differently" tends to be a shortcut, a hack, an indication that something isn't right and couldn't be fixed nicely.

  • Most people don't need a file to be in two places at once, it's more confusing than convenient. And if they do want two of a file at all, they almost certainly want them to be separate copies so that the original stays unmodified when they edit the second one. Anyone who really wants a hard link is probably comfortable with the command line, or should get comfortable.

    The Mac actually kind of gets the best of both worlds, APFS can clone a file such that they aren't hard links but still share the same blocks of data on disk, so the second file takes up no more space, and it's only when a block gets edited that it diverges from the other one and takes up more space, while the unmodified blocks remain shared. It happens when copy-pasting or duplicating a file in the Finder as well as with cp on the command line. I'm sure other modern file systems have this as well.

  • I also think it's AI, the text has that weird "too neat to be done by hand, too loose to be typed" look to it. Not a lot of obvious flaws in the actual drawing, although the coloring between the legs isn't right in a way that I'd think a human would catch.

  • It doesn't have to be a big baroque thing. When there's a dotfile I configure regularly, I move it to a Git repo and use stow to put it "back" into place with a symlink. On new machines, it isn't long before I try something that doesn't work or see the default shell prompt and go "oh yeah, I want my dotfiles", check out the repo, run a script that initializes a few things (some stuff is machine-specific so the script makes files for that stuff with helpful comments for me to remember the differences between login shells or whatever) and then I'm off to the races.

  • Hint: the solution depends on a more realistic and physics-based model of the problem than you're using. And, even bigger hint, it's less intuitive now that light bulb technology has changed to become much more efficient, you should imagine this problem taking place with a '90s bulb.

  • Rules exist so that you think a second time before you break them.

  • I wish this attitude was more pervasive at Apple, my phone actually autocorrects to "Lock Screen" when I type it out in lower case.

  • I don't understand why this works, but it does

    What was happening before was this: Git received your commits and ran the shell script. It directed the script's output stream back to Git so that it could relay it back over the connection to display on your local terminal with remote: stuck in front of it. Backgrounding the npx command was working, the shell was quitting without waiting for npx to finish. However, Git wasn't waiting for the shell script to finish, it was waiting for the output stream to close, and npx was still writing to it. You backgrounded the task but didn't give npx a new place to write its output to, so it kept using the same output stream as the shell.

    Running it via bash -c means "don't run this under this bash shell, start a new one and have it just run this one command rather than waiting for a human to type a command into it."

    The & inside the quote is doing what you expect, telling the subshell to background this task. As before, it'll quit once the command is running, as you told it not to wait.

    The last bit is &> /dev/null which tells your original, first shell that you want this command to write somewhere else instead. Specifically, the special file /dev/null, which, like basically everything else in /dev/, is not really a file, it's special kernel magic. That one's magic trick is that when you write to it, everything works as expected except all the data is just thrown away. Great for things like this that you don't want to keep.

    So, the reason this works is you're redirecting the npx output elsewhere, it just goes into a black hole where no one is actually waiting for it. The subshell isn't waiting for the command to finish, so it quits almost immediately. And then the top level shell moves on after the subshell has finished.

    I don't think the subshell is necessary, if you do &> /dev/null & I think it'd be the same effect. But spawning a useless shell for a split second happens all the time anyway, probably not worth worrying about too much.

  • The top one is fairly normal, the bottom one is the same program, still in C, but redone to be as BASIC-like as possible, complete with line number labels and using goto instead of any of the normal control flow structures like while and for loops.

  • That's a funny bit of progressive cognitive dissonance. Obviously representation is important, and it's critical that kids see people like themselves in all roles, not just the stereotypical ones... but also, why wouldn't women be able to figure out how to effectively teach boys in school, they're just as capable as men are, it shouldn't matter!

  • In Haskell, that's "unit" or the empty tuple. It's basically an object with no contents, behavior, or particular meaning, useful for representing "nothing". It's a solid thing that is never a surprise, unlike undefined or other languages' nulls, which are holes in the language or errors waiting to happen.

    You might argue that it's a value and not a function, but Haskell doesn't really differentiate the two anyway:

     
        
    value :: String
    value = "I'm always this string!"
    
    funkyFunc :: String -> String
    funkyFunc name = "Rock on, "++name++", rock on!"
    
      

    Is value a value, or is it a function that takes no arguments? There's not really a difference, Haskell handles them both the same way: by lazily replacing anything matching the pattern on the left side of the equation with the right side of the equation at runtime.

  • The far right loves a strong man, and by definition there can be only one of those, prefers when "the natural order" is followed, and thinks the ends always justify the means. That keeps them pretty cohesive with the establishment right, who are making buckets of money under the system as it is now and are okay with just about anything else as long as that doesn't change. When they fight, it's because the far right is trying to do something stupid enough that the establishment thinks it risks their money or power, or the establishment is holding the far right back from fully implementing their "natural order" worldview, but there's a lot of overlap where both can be happy, because the establishment really has no morals at all and are happy to use the far right to gain power if all they have to do is throw them some red meat every once in a while.

    The left's a very different story. On the far left, people are very principled, to the point where compromise or partial wins feel hollow because the only real win would be the entire principle being adopted en masse. It makes it harder to work together, because even groups with the same goals can get frustrated by the way the other one is doing it, or because the other group is going to keep going while the other wants to stop sooner. And the establishment left has a fair amount in common with the establishment right, they find the right's goals uncouth and mean, but they do still fundamentally believe in capitalism and don't want to upend the system. That leaves a lot less common ground and a lot more infighting overall.

  • I most associate it with Slashdot comments in the 2000's, complaining about Microsoft spreading fear, uncertainty, and doubt about Linux and the GPL to scare companies into thinking that if they used Linux, they'd have to open source all their software, so yeah, definitely not just a cryptocurrency term.

  • I got the .net and .org of my last name, and offered $50 to the owner of the .com as he wasn't doing anything with it. Kind of a lowball, admittedly, but I would've gone up to a hundred or two. Instead, he told me it was worth thousands, which, lol, but then he didn't renew it, which I only found out because a random third person reached out to me as the owner of the .net offering me the .com. Turns out they hadn't actually bought it yet, though, so instead I scooped it up and now I've got the trifecta!