These are chat archives for MetaStack-pl/MetaRx

May 2016
Matthew Pocock
May 25 2016 10:33
I've got a Var bound to a text area input. It is firing an update on every interaction with the text area, including scrolling around with arrow keys. Is there a way to tell a Var to drop value firing events that are identical values with the previous value? A sort of 'only when changed' filter?
Tim Nieradzik
May 25 2016 13:57
Yes, you can use distinct
Matthew Pocock
May 25 2016 15:05
thanks, that works
Matthew Pocock
May 25 2016 22:07
hi - something very wrong is happening with the reactives in my application
it seems like somewhere an entire log of past state is being replayed, getting cumulatively larger and larger
Matthew Pocock
May 25 2016 22:24
OK, it looks like the repetitions are coming from a for comprehension
 for {
    txt <- dotTextDistinct
    url <- gvUrl
    parsed <- parseStatus if parsed
  } yield {
this seems to be invoking the body for some historical accumulation of the past values of txt, url and parsed
Matthew Pocock
May 25 2016 22:34
ah - I wonder if flatmap is what's doing the nasty
so x.flatMap(T => ReadChannel[U]) will generate a new ReadChannel[U], each one closing over the value of Tit was geneated on. These are then all bound as down-stream consumers of x. When x fires, a new ReadChannel[U] is created. All the ReadChannel values then will fire in parallel as the U source fires, resulting in a whole load of parallel results getting spat out
Matthew Pocock
May 25 2016 22:40
the comprehension desugars to:
  (dotTextDistinct).flatMap {
    case txt => (gvUrl).flatMap {
      case url => (((parseStatus).filter { case (parsed) => parsed })).map {
        case parsed => {
Matthew Pocock
May 25 2016 22:53
OK, I've re-written this without any sugar using zip, filter and bind: