Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 01 10:11
    @SystemFw banned @Hudsone_gitlab
  • Jan 31 2019 04:19
    404- forked
    404-/fs2
  • Jan 31 2019 03:01
    SethTisue commented #1232
  • Jan 30 2019 17:22
  • Jan 30 2019 13:45
  • Jan 30 2019 10:48
    pchlupacek commented #1406
  • Jan 30 2019 10:47
    pchlupacek commented #1406
  • Jan 30 2019 10:39
    pchlupacek commented #1407
  • Jan 30 2019 09:58
    lJoublanc commented #870
  • Jan 30 2019 09:42
    vladimir-popov commented #1407
  • Jan 30 2019 08:10
    vladimir-popov closed #1407
  • Jan 30 2019 08:10
    vladimir-popov commented #1407
  • Jan 29 2019 19:20
    SystemFw commented #1407
  • Jan 29 2019 19:20
    SystemFw commented #1407
  • Jan 29 2019 18:57
    SystemFw commented #1406
  • Jan 29 2019 17:47
    pchlupacek commented #1406
  • Jan 29 2019 17:42
    pchlupacek commented #1406
  • Jan 29 2019 17:39
    pchlupacek commented #1407
  • Jan 29 2019 17:39
    vladimir-popov edited #1407
  • Jan 29 2019 17:38
    vladimir-popov commented #1406
Andrey
@404-

we do have a nondetermistic zip, but it uses the latest, it doesn't wait for two new values as you wish

what is it named?

Fabio Labella
@SystemFw
you need to go through Signal
so, get signals from stream using hold, combine the signals applicatively with mapN, then get a Stream back with discrete
Andrey
@404-
just to confirm (it does seem to work):
val nums  = Stream.range[IO](1, 10).metered(1.second)
val chars = Stream.range[IO]('a', 'z' + 1).map(_.toChar).metered(500.millis)
val zipped = for {
  a <- nums.hold(0L)
  b <- chars.hold('\0')
  c <- (a, b).tupled.discrete
} yield c
Peter Aaser
@PeterAaser
Add scala after the backticks for proper formatting
:+1:
Andrey
@404-
@PeterAaser done - thank you for the hint, will definitely use it from now on
Peter Aaser
@PeterAaser
no worries :)
Andrey
@404-
hmm the above does seem to "hang", so something isn't getting closed/cleaned up. ideas?
"hang" after both streams have finished
Peter Aaser
@PeterAaser
Not looked very closely at what you're doing, but you might need noneTerminate
Since you can no longer tell for sure if the stream is terminated or not
(just from a cursory eyeballing)
Andrey
@404-
let me give that a shot
Gavin Bisesi
@Daenyth
what type is zipped?
I wonder if for is incorrect
Andrey
@404-
Stream[IO, (Long, Char)]
do signals have some special logic for termination/completion?
Peter Aaser
@PeterAaser
No
Gavin Bisesi
@Daenyth
I just wasn't sure of the api there
for seems right
I agree that your signals don't terminate
hold javadoc says If the source stream is empty, the resulting signal will always be initial.
Peter Aaser
@PeterAaser
They need to be NoneTerminated
Fabio Labella
@SystemFw
it's not about emptiness
Peter Aaser
@PeterAaser
Signals don't really terminate
Fabio Labella
@SystemFw
Peter is right
a Signal describes changing over time
Peter Aaser
@PeterAaser
Literally gonna frame this on my wall
Fabio Labella
@SystemFw
if you say discrete, it means emit all changes
Gavin Bisesi
@Daenyth
right, it's not about emptiness, but the javadoc there implies that the streaming from the signal will never terminate
that's what I was getting at
Andrey
@404-
i've been playing around with none terminating it, but i'm not sure which streams need to be noneTerminated
Fabio Labella
@SystemFw
when the source stops changing (because it's done), discrete waits for ever, not unlike a queue that isn't getting enqueued to anymore
Andrey
@404-
the original ones (nums and chars) or the outgoing one
Peter Aaser
@PeterAaser
@404- That's tricky
Took me a while to get the correct mental model, and I still get it wrong from time to time
Gavin Bisesi
@Daenyth
I'd say both incoming need noneTerminated and then .discrete.unNoneTerminate
Peter Aaser
@PeterAaser
Yeah, sounds about right
Gavin Bisesi
@Daenyth
I think actually .discrete.map(_.tupled).unNoneTerminate
no?
Andrey
@404-
hmm tupled doesn't quite suit the purpose because Some + None = None
Fabio Labella
@SystemFw
but that's the heart of the issue
when do you want to terminate?
Gavin Bisesi
@Daenyth
@404- that was my intent
either terminate = output terminate
Andrey
@404-
well, the change i made was a <- nums.noneTerminate.hold(None)
which is what's going to make it terminate immediately...
Fabio Labella
@SystemFw
the hold is wrong
it should be hold(0L.some)