Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: