You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discussion with @headinthebox suggests that the conditional operators really don't belong in RxJava (at least not the core) as they were added to Rx.Net for very specific use cases in F#.
These include ifThen, switchCase, doWhile, whileDo.
Are there reasons to keep these? If so do we move them out of Observable or should we delete them?
These can be used for CEP scenarios to reason over multiple streams. It is best that they stay in some form or other as Java does not have anonymous classes like C# where they could be easily avoided by joining fields into a anonymous class. They are more needed in the JVM implementation than in .net.
Ideally the senarios should be expanded in RxJava.
@sirinath can you give a concrete example? I don't see the connection between these operators which are intended to overload imperative control structures in F# computation expressions and anonymous types.
If this is extended to accept an observable sequence as the condition / selector then it would be more useful.
Say I want to buy using signal A if vol is greater than a certain threshold plus some other computationally expensive conditions and signal B otherwise only if I am trading that instrument for the day and I only trade 0.5% of instruments.
The current form is somewhat useful if we want to certain set of signals at start of the day but this is something you can do otherwise eagerly at a cost. Also it would be useful if the conditional is also an observable sequence as you can select between streams than at subscription. Using Linq you can aggregate multiple items into anonymous class and select what is needed at the end from this in a further query. This is more difficult though possible in Java than C# hence it will be good to have the conditional functionality extended for other use cases.
More powerful it would be if you have linq Expressions. This is also possible through Commons JCI or directly using Janino. Perhaps at a later stage.
Also the conditions or index can be extended to a function to take 1 item from each stream and return the appropriate values (boolean / index) for item selection. If not subscribers the condition is not evaluated and if possible each item can be discarded from the streams.
This would be a more convinient way to use this functionality.
Activity
headinthebox commentedon Dec 24, 2013
http://msdn.microsoft.com/en-us/library/dd233182.aspx
I don't know of anyone using this for real in Rx.NET.
akarnokd commentedon Dec 24, 2013
These could be moved into a
rxjava-contrib/rxjava-dotnet-legacypackage along with those ops that have been added just to match Rx.Net.sirinath commentedon Dec 27, 2013
These can be used for CEP scenarios to reason over multiple streams. It is best that they stay in some form or other as Java does not have anonymous classes like C# where they could be easily avoided by joining fields into a anonymous class. They are more needed in the JVM implementation than in .net.
Ideally the senarios should be expanded in RxJava.
headinthebox commentedon Dec 27, 2013
@sirinath can you give a concrete example? I don't see the connection between these operators which are intended to overload imperative control structures in F# computation expressions and anonymous types.
sirinath commentedon Dec 28, 2013
If this is extended to accept an observable sequence as the condition / selector then it would be more useful.
Say I want to buy using signal A if vol is greater than a certain threshold plus some other computationally expensive conditions and signal B otherwise only if I am trading that instrument for the day and I only trade 0.5% of instruments.
The current form is somewhat useful if we want to certain set of signals at start of the day but this is something you can do otherwise eagerly at a cost. Also it would be useful if the conditional is also an observable sequence as you can select between streams than at subscription. Using Linq you can aggregate multiple items into anonymous class and select what is needed at the end from this in a further query. This is more difficult though possible in Java than C# hence it will be good to have the conditional functionality extended for other use cases.
More powerful it would be if you have linq Expressions. This is also possible through Commons JCI or directly using Janino. Perhaps at a later stage.
sirinath commentedon Dec 30, 2013
Also the conditions or index can be extended to a function to take 1 item from each stream and return the appropriate values (boolean / index) for item selection. If not subscribers the condition is not evaluated and if possible each item can be discarded from the streams.
This would be a more convinient way to use this functionality.
headinthebox commentedon Jan 2, 2014
@sirinath Could you provide a concrete example? I am not sure that I understand what you are after precisely.
rxjava-computation-expressions
benjchristensen commentedon Jan 2, 2014
Migrating conditionals to a contrib module: #714
benjchristensen commentedon Jan 2, 2014
Here is a link to documentation on their usage: http://weblogs.asp.net/podwysocki/archive/2010/06/18/introduction-to-the-reactive-extensions-for-javascript-conditionals.aspx
sirinath commentedon Jan 3, 2014
@headinthebox
Add an extra overload with Func<bool, TResult, TResult> condition for if and Func<TValue, TResult[]> selector ... etc.
if(
(a, b) -> !a.equals(obj1) && b.equals(obj2),
strm1,
strm2)
this case condition is evaluated as needed but for each element coming in
sirinath commentedon Jan 5, 2014
@headinthebox
In a nutshell the extension will help combination and generation. Something you can consider for the main implementation also.
rxjava-computation-expressions