Hacker News new | ask | show | jobs
by marginalia_nu 125 days ago
Yeah I've been collecting some of the weirdest ones I've seen floating by. It's really the only thing that has me visiting linkedin.

https://www.marginalia.nu/junk/linked/games.jpeg

https://www.marginalia.nu/junk/linked/json.png

https://www.marginalia.nu/junk/linked/syntax.png

(and before anyone tells me to charge my phone, I have one of those construction worker phones with 2 weeks battery. 14% is like good for a couple of days)

4 comments

The red apple streams one is good. It shows how developers chase shiny new stuff with no respect for fundamentals. They will say it's less code, and then show you more code.
The apples one is LLM nonsense: the left example doesn’t include any code for the loop, whereas the streams version actually is iterating over a collection.

Regardless, FP-style code isn’t “shiny new stuff”—it’s been around for decades in languages like Lisp or Haskell. Functional programming is just as theoretically “fundamental” as imperative programming. (Not to mention that, these days, not even C corresponds that closely to what’s actually going on in hardware.)

>> apples.stream()

>> .filter (a -} ajsRed());

>> .forEach(giveApple); [sic]

> The red apple streams one is good. It shows how developers chase shiny new stuff with no respect for fundamentals.

The problem isn’t streams, it’s slop.

Care to explain the last one? The presentation is weird and stupid, but I don't see any obvious (technical) issue other than the missing bracket on the left, unlike the first two
Iterative example doesn't iterate, mismatches parentheses and brackets. Because of this, the iterative example is shorter and simpler than the "short & simple" lambda example.

Lambda example is to the best of my parsing ability this:

  apples.stream()
    .filter(a -λ a.isRed());  // <-- note semicolon
    .forEach(giveApple);
Should be

  apples.stream()
    .filter(a -> a.isRed()) // or Apple::isRed
    .forEach(a -> giveApple(a)); // or this::giveApple
It's also somewhat implied that lambdas are faster, when they're generally about twice as slow as the same code written without lambdas.
It's interesting to see how LLMs make mistakes sometimes: replacing `->` with `-λ` because arrow sort-of has the same meaning as lambdas in lambda calculus. It's like an LLM brain fart replacing something semantically similar but nonsensical in context.
Probably morphed > into λ because they're similar shapes, and lambda was in the prompt. Image models are often prone to that sort of hallucination.
The 'long' code for checking apples is shorter, but it's missing the external for loop. So I guess you could say it's not (ahem) an apples to apples comparison.
I'm not OP but:

- missing ")" on the left side

- extra "}" on the right side

- the apples example on the right side ("Short code") ist significantly longer than the equivalent "Long code" example on the left side (which might also be because that code example omits the necessary for loop).

- The headings don't provide structure. "Checking Each Apple" and "Only Red Apples!" sounds like opposites, but the code does more or less the same in both cases.

No “for” loop in the example purportedly showing an iterative approach.

Not mentioning the pain of debugging the streaming solution is also a little disingenuous.

Those are so funny that I was forgetting to breathe as I was laughing so hard, man that's excellent haha. Thanks for sharing them, even if we are cooked as a society...
Minecraft JAVA --------> C++

that one gave me an actual lol.