• 1 Post
  • 21 Comments
Joined 1 year ago
cake
Cake day: July 3rd, 2023

help-circle




  • I’m really surprised to see Java ranked as less-verbose than OCaml.

    Here’s an equivalent code sample in Java 17 vs OCaml:

    Java:

    abstract sealed class Expr permits Value, Add, Subtract, Multiply, Divide {
      abstract long eval();
    }
    record Value(long value) extends Expr {
      @Override
      long eval() { return value; }
    }
    record Add(Expr left, Expr right) {   
      @Override
      long eval() { return left.eval() + right.eval(); }
    }
    record Subtract(Expr left, Expr right) {
      @Override
      long eval() { return left.eval() - right.eval(); }
    }
    record Multiply(Expr left, Expr right) {
      @Override
      long eval() { return left.eval() * right.eval(); }
    }
    record Divide(Expr left, Expr right) {
      @Override
      long eval() { return left.eval() / right.eval(); }
    }
    

    OCaml:

    type expr = 
      | Value of int
      | Add of expr * expr
      | Subtract of expr * expr
      | Multiply of expr * expr
      | Divide of expr * expr
    
    let rec eval = function 
      | Value value -> value
      | Add (left, right) -> (eval left) + (eval right)
      | Subtract (left, right) -> (eval left) - (eval right)
      | Multiply (left, right) -> (eval left) * (eval right)
      | Divide (left, right) -> (eval left) / (eval right)
    

    …Java has so much more syntactical overhead than OCaml, and that’s even with recent Java and being pretty aggressive about using boiler-plate reducing sugars like Records. And F# has even less, since it doesn’t require you to use different operators for numerics or do as much manual casting between strings/numerics


  • spencerwi@lemm.eetoAntiwork@lemmy.worldTesla founders
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    1 year ago

    Notably, Woz found out decades later, after Steve was dead already, when he was interviewed by someone who told him the whole story.

    I like to think that if Jobs were alive today, the general public would see him as the Elon Musk type that he was. Instead, he died before his cult of personality could properly sour on him.



  • Conversely, I have a recent-ish (<5yrs old) Brother inkjet printer that’s waiting to be dumped to recycling because it arbitrarily decided that it didn’t ever need to be discoverable or respond to any print requests one day, and so even though there was nothing mechanically wrong with it, even hooking up a Raspberry Pi to run CUPS over USB didn’t fix the issue – because Brother explicitly refuses to publish drivers for the Raspberry Pi, and their inkjet drivers are proprietary.

    I’ve since replaced it with the best-reviewed Epson printer I could find that supports a generic PCL driver, so that if Epson ever loses their minds in the way Brother did, I can fall back on an open-source implementation of good ol’ PCL.

    That thing’s given us no issues so far.


  • spencerwi@lemm.eetoPolitical Memes@lemmy.worldEverything you need to know
    link
    fedilink
    arrow-up
    10
    arrow-down
    2
    ·
    edit-2
    1 year ago

    The cropping is not accurate to the question asked at the debate, but every candidate there signed a pledge to back whoever wins the GOP primary, and right now that includes Trump as an option.

    So for Hutchinson and Christie, the only way this image is not an accurate representation of their stances (if not how they answered the question on stage) is if we assume that they were lying when signing the “loyalty pledge” document that was a requirement for even being on the stage at all.

    Christie in particular opposed Trump in the 2016 election…all the way until Trump got the nomination, at which point Christie became an ardent Trump supporter. I think it’s reasonable to assume this is a repeat of that track record on his part.








  • It seems mostly like a boomer thing to do, honestly; I don’t really hear “I hate my wife/husband” jokes from folks my generation (Millennials) or younger. Honestly, I mostly hear “I hate myself” jokes there.

    A lot of the “ol’ ball and chain” etc jokes tend to be more frequently casting the wife as the enemy instead of the husband, too, so there’s some definite boomer misogyny as key element.





  • Knee surgery that wasn’t on his radar, his team’s radar, or his agent’s radar until he was told that the rookie was gonna get a shot to start next game.

    Sure, fine, take your elective season-ending surgery, but don’t try to play it like you had to leave, or like the team and coach that covered for you all season long and gave you a wildly-improbably second chance at being a starter when the rest of the league already knew you were broken somehow owed you something. You got paid millions to live every backup’s dream – a shot at becoming the guy – and your coach stuck by you long after you blew that chance.

    Then you go and make yourself totally unavailable even to be on the bench for the new kid who got comp’d to you and looks up to you?

    I really don’t understand how Mariota got his “he’s a nice guy” reputation, except maybe by contrast to Jameis because they were in the same draft class.


  • I don’t get why this is a headline.

    There are two pieces of non-new information from this headline:

    1. People throw away pamphlets that they don’t care about (and also pamphlets that they do care about, but that’s not what’s happening here).
    2. Boebert doesn’t care about school shootings.

    …like…I get that this gives someone their outrage fix for the day, but we’ve learned nothing new from it, and it has no long-term impact. If Boebert took this pamphlet to her house and then ignored it, nothing would be different. She’d still be callous and uncaring towards the victims of school shootings.