arr.mapFlat()
because it maps first, then flats.
I often *do* want to flat first then map, and accidentally reach for flatMap() 🤨
arr.mapFlat()
because it maps first, then flats.
I often *do* want to flat first then map, and accidentally reach for flatMap() 🤨
.map(Customer::id)
.flatMap(service::thing
.collectList()
.flatMap(list -> Mono.zi(Mono.just(list, otherThing(format(format, join(delimiter, list.strea().map(Thing::id).toList())).map(tuple ...)
What the fuck is wrong with you?
Why would you nest so many functions?
.map(Customer::id)
.flatMap(service::thing
.collectList()
.flatMap(list -> Mono.zi(Mono.just(list, otherThing(format(format, join(delimiter, list.strea().map(Thing::id).toList())).map(tuple ...)
What the fuck is wrong with you?
Why would you nest so many functions?
Você pode transformar com o toStream, mas isso significa que não dá pra usar method reference.
Tô quase retornando Stream ao invés de Optional em alguns métodos.
Você pode transformar com o toStream, mas isso significa que não dá pra usar method reference.
Tô quase retornando Stream ao invés de Optional em alguns métodos.
Map to double é só uma funcão 1:1 aplicada em uma lista. Pode ser feita como um reduce (ou recursão, obviamente)
Map to double é só uma funcão 1:1 aplicada em uma lista. Pode ser feita como um reduce (ou recursão, obviamente)
Poderia tentar fazer ambos ao mesmo tempo? Sim, mas seria um abuso de como fazer esse mapeamento via flatmap da vida, ou um reduce próprio o que na minha visão perde o sentido.
Poderia tentar fazer ambos ao mesmo tempo? Sim, mas seria um abuso de como fazer esse mapeamento via flatmap da vida, ou um reduce próprio o que na minha visão perde o sentido.
https://github.com/tc39/proposal-flatMap/pull/56#issuecomment-371224179
https://github.com/tc39/proposal-flatMap/pull/56#issuecomment-371224179
Eg.
[[1], [2,2], [3,3,3]].reduce((acc, curr, idx) => idx > 1 ? [...acc, ...curr] : acc, [])
I'd argue chaining filter and flatMap is usually clearer tho
Eg.
[[1], [2,2], [3,3,3]].reduce((acc, curr, idx) => idx > 1 ? [...acc, ...curr] : acc, [])
I'd argue chaining filter and flatMap is usually clearer tho
- Set is now a final class
- adds Set::flatMap() to randomly declare new Sets
- adds PHPUnit 12 support
github.com/Innmind/Blac...
- Set is now a final class
- adds Set::flatMap() to randomly declare new Sets
- adds PHPUnit 12 support
github.com/Innmind/Blac...
🤣🤣🤣 I still wish it was Array.smoosh() https://twitter.com/ChromiumDev/status/1037022478927912961
🤣🤣🤣 I still wish it was Array.smoosh() https://twitter.com/ChromiumDev/status/1037022478927912961
It would have me days of my life if I added up all the time I’ve spend arriving at that conclusion.
It would have me days of my life if I added up all the time I’ve spend arriving at that conclusion.