Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 14 04:12
    scala-steward closed #116
  • Jun 14 04:12
    scala-steward commented #116
  • Jun 14 04:12
    scala-steward opened #117
  • Jun 01 04:13
    scala-steward closed #107
  • Jun 01 04:13
    scala-steward commented #107
  • Jun 01 04:13
    scala-steward opened #116
  • May 28 22:08
    scala-steward closed #112
  • May 28 22:08
    scala-steward commented #112
  • May 28 22:08
    scala-steward opened #115
  • May 28 08:00
    scala-steward closed #90
  • May 28 08:00
    scala-steward commented #90
  • May 28 08:00
    scala-steward opened #114
  • May 21 16:09
    scala-steward opened #113
  • May 20 00:09
    scala-steward closed #108
  • May 20 00:09
    scala-steward commented #108
  • May 20 00:09
    scala-steward opened #112
  • May 17 14:18
    scala-steward closed #91
  • May 17 14:18
    scala-steward commented #91
  • May 17 14:18
    scala-steward opened #111
  • May 13 22:17
    scala-steward closed #101
Gabriel Volpe
@gvolpe
Hi @etorreborre I saw there's an fs2 package with some functions to integrate with origami's Fold. I came up with an alternative way to write scanEval, would you take a PR? I haven't bechmarked it but rather focused on a pure functional implementation on top of Ref which is quite optimized
def scanEval[F[_]: Sync, S, A](p: Stream[F, A])(start: F[S])(f: (S, A) => F[S]): Stream[F, S] = {

  def zipper(ref: Ref[F, S]): Stream[F, S] =
    p.zip(Stream.eval(ref.get).repeat).evalMap { case (a, s) =>
      for {
        ns <- f(s, a)
        _  <- ref.set(ns)
      } yield ns
    }

  for {
    st  <- Stream.eval(start)
    ref <- Stream.eval(Ref.of[F, S](st))
    rs  <- zipper(ref)
  } yield rs
}
Eric Torreborre
@etorreborre
yes go for it
Gabriel Volpe
@gvolpe
Great, thank you! Folds are awesome :heart:
Eric Torreborre
@etorreborre
yep I love them too :-)
Gabriel Volpe
@gvolpe
Here -> #8 , will read any comments tomorrow :smile:
Sanjeev Singh
@Sanji515
Hello I'm new here. How to start
Please guide me.
Eric Torreborre
@etorreborre
@Sanji515 my first question is “what’s your use case?”. You generally use origami when you have a “stream” of data (with fs2 stream for example) and if you want to “collect/aggregate/sink” this data. This can be done by creating “folds” which have the nice property of being composable so that 2 “folds” can be stitched together to form a larger “fold” operating on your stream. So if you have a small example of a stream you want to process we could start from there