let move2 = moves > Observable.map (fun (e:PointerEventArgs) -> canvas > e.GetPosition)…
- User
let move2 = moves |> Observable.map (fun (e:PointerEventArgs) -> canvas |> e.GetPosition) //|> Observable.map (fun pos -> scrToGrid pos.X , scrToGrid pos.Y ) //naive convert to loc |> Observable.map (fun pos -> pointToCellTupleWithThreshold pos 100 ) //naive convert to loc
|> Observable.distinctUntilChanged //try withoutin this f# rx.net code i have an IObservable<(intint) option> observable, and i want to convert it to the IObservable<(intint)>
so, just leting those with value pass trough and filtering empty ones? Can you write one line that will to this?
Assistant
You can use
Observable.choosewhich filters outNonevalues and unwrapsSomevalues in one operation:|> Observable.choose idThis will convert your
IObservable<(int*int) option>toIObservable<(int*int)>by filtering outNonevalues and unwrapping theSomevalues.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.