Comments (5)
You can use splitBy, which is present on ImmutableList, ImmutableQueue, ImmutableSortedSet and ReactiveSeq to do this.
But we should add a static convenience method on Either also.
from cyclops.
My only issue with split by is that the signature doesn't quite unpack the datatypes (which is totally reasonable/expected for a generic split by).
Seq<Either<A, B>>.splitBy -> Tuple2<Seq<Either<A, B>>, Seq<Either<A, B>>>
instead of
Seq<Either<A, B>>.eitherSplitBy->Tuple2<Seq<A>, Seq<B>>
Right now, I'm just manually accumulating, which is a pretty simple, although, really verbose workaround (and I'm not sure of its streaming vs loading into memory ramifications for larger use cases).
It would also be useful as a static method on try directly as well.
from cyclops.
As a related question, is there a pattern for not only splitting the response try/either but also keeping the original request with it?
something where
function: request -> Try<Response, Exception>;
List requests.map(this::function)->??????->Tuple2<List<Tuple2<Request, Response>>, List<Tuple2<Request, Exception>>>
happens?
Right now I'm just manually passing along the request everywhere.
from cyclops.
Added partitionEithers, lefts, rights as static methods to the Either class.
from cyclops.
Merged.
from cyclops.
Related Issues (20)
- Seq plusAll should provide efficient prepending HOT 1
- Jackson Serialization of nested IterableX types results in a null pointer exception. HOT 1
- [FutureStream] : Some operators are blocking until previous Futures have completed HOT 1
- Add onEmptySwitch for Values to OrElseValue HOT 2
- Remove deprecated orElseUse methods
- Maybe filter is not executed lazily HOT 1
- Ior mkString should build values in order matching Generic definitions HOT 1
- Project website currently down HOT 1
- RemoveFirst is stateful HOT 1
- ReactiveSeq.sorted relies on the Stream implementation and is not replayable HOT 1
- Infinite loop with recoverFlatMap HOT 1
- Printing a Vector containing a null, results in a NullPointerException HOT 1
- Migrate Validated to NonEmptyChain
- Is there a guide to using Validated? HOT 1
- Question: Does Topic holds all stream elements?
- futureStream from Queue<T> does not fire on timeout. HOT 2
- Question: purpose of the included test cases
- Jackson support for Option seems to not work? HOT 1
- Project abandoned HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cyclops.