• 0 Posts
  • 30 Comments
Joined 3 months ago
cake
Cake day: July 23rd, 2024

help-circle

    • yellow
    • male
    • round face, beard, brown hair, mid 20s (I think probably some internet-famous person whose name I don’t remember)
    • small plastic ball filled with air
    • a simple square table with a natural wood top and legs

    That was my first thought. But then (before reading the questions) I also imagined other similar scenarios like with a soccer ball and my desk at work, lol.

    My experience with this experiment was kind of like when they play memory flashbacks in movies, I could see the ball being pushed and falling, but with jump cuts and the timing was off. Detail-wise I’d say it was kinda like what you got from AI image generation when Dall-E first came out two-ish years ago.

    I don’t think I have the most visual imagination out there but if aphantasia is one end of the scale I’m pretty far to the other side.










  • Yeah, in Java calling first() on a stream is the same as an early return in a for-loop, where for each element all of the previous stream operations are applied first.

    So the stream operation

    cars.stream()
        .filter(c -> c.year() < 1977)
        .first()
    

    is equivalent to doing the following imperatively

    for (var car : cars) {
        if (car.year() < 1977) return car;
    }
    

    Not to mention Kotlin actually supports non-local returns in lambdas under specific circumstances, which allows for even more circumstances to be expressed with functional chaining.