| ▲ | marginalia_nu 2 hours 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) |
|
| ▲ | g947o an hour ago | parent | next [-] |
| 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 |
| |
| ▲ | marginalia_nu 24 minutes ago | parent | next [-] | | 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. | |
| ▲ | raphman an hour ago | parent | prev | next [-] | | 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. | |
| ▲ | carlob an hour ago | parent | prev | next [-] | | 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. | |
| ▲ | donkey_brains an hour ago | parent | prev [-] | | 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. |
|
|
| ▲ | girvo 2 hours ago | parent | prev [-] |
| 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... |