Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    captainmannering
    @captainmannering
    @RejectKid - did you get a solution for your question? I have the same need as you.
    Dorus
    @Dorus
    @captainmannering @RejectKid Something like
    timer = Observable.Timer(time).Share();
    
    Source
      .GroupBy(...)
      .SelectMany(group => group.Sample(timer))
    Johan Larsson
    @JohanLarsson
    @Dorus you up for reviewing a PR?
    Just a couple of lines so don't worry :)
    Dorus
    @Dorus
    @JohanLarsson I can take a look and give my opinion, but i dont see any link :)
    Dorus
    @Dorus
    @JohanLarsson Reminds me of Buffer(2,1)
    Johan Larsson
    @JohanLarsson
    yes, it is the same
    Dorus
    @Dorus
    looks good at first sight
    Johan Larsson
    @JohanLarsson
    But typed
    I'm not super happy with the names Pair() and Paired<T>
    Dorus
    @Dorus
    Buffer(2,1).Select(a => new Paired(a[0], a[1]))
    Johan Larsson
    @JohanLarsson
    Thought about WithPrevipous()
    Dorus
    @Dorus
    Why not use a tupel?
    {Previous: ..., Current: ...}
    Johan Larsson
    @JohanLarsson
    Why not use a struct?
    I don't use value tuples much so don't really know how the named fields work when it is in a library
    Dorus
    @Dorus
    Can those be generic? Tupels can have named fields.
    It depends on what version of .net and C# you have. Tupels are kinda new.
    Can those be generic?
    Dorus
    @Dorus
    But just your own class seems fine too.
    Johan Larsson
    @JohanLarsson
    Is that about struct?
    Dorus
    @Dorus
    Yeah i was wondering if a struct could be generic.
    But i see no harm in using a class, you could argue about the name indeed.
    Paired with current and previous fields is kinda weird.
    Johan Larsson
    @JohanLarsson
    agreed
    Dorus
    @Dorus
    Buffered?
    Johan Larsson
    @JohanLarsson
    thought about it
    Dorus
    @Dorus
    In RxJs they have Pairwise as operator name.
    Johan Larsson
    @JohanLarsson
    it is probably better as it suggests order
    Dorus
    @Dorus
    https://rxjs.dev/api/operators/pairwise
    But it just returns an array. They didn't name it.
    Johan Larsson
    @JohanLarsson
    My thinking was Pair() -> Paired<T> like Timestamp() -> Timestamped<T> but was not super happy with it.
    Dorus
    @Dorus
    I would use Pair<T> and Timestamp<T>, but then your operator and type have the same name. Is that a problem?
    Johan Larsson
    @JohanLarsson
    Pair() is not awesome either
    Dorus
    @Dorus
    Pairwise() : Observable<Pair<T>>?
    Johan Larsson
    @JohanLarsson
    probably better
    or Pairwise() : Observable<Pairwised<T>>
    Pair<T> is not ideal as a public type with fields Current and Previous
    Dorus
    @Dorus
    Idk if i like verb type names.
    Yeah but Pairwised doesn't improve that.
    Dorus
    @Dorus
    interesting
    Johan Larsson
    @JohanLarsson
    ^ is the reason I'm going on about Paired<T> stay consistent with the framework
    Dorus
    @Dorus
    But then you can write almost all your types in paste tense.
    But it's not wrong since we work with async data. Mmmm
    I can agree with consistency.
    aka Observable<Timestamp<T>> timestamp(this Observable<T> source, IScheduler scheduler) in C#
    Adam Buchanan
    @RejectKid
    @Dorus Perfect thank you!