Re: [akka-user] scan and map

2016-01-29 Thread Richard Rodseth
Thanks! Sent from my phone - will be brief > On Jan 29, 2016, at 5:25 AM, Endre Varga wrote: > > > >> On Fri, Jan 29, 2016 at 1:21 PM, Martynas Mickevičius >> wrote: >> Hi, >> >> you can do that using scan with something like this (not compiled): >> >> flow.scan(zero = (0, 0)) { >> case

Re: [akka-user] scan and map

2016-01-29 Thread Endre Varga
On Fri, Jan 29, 2016 at 1:21 PM, Martynas Mickevičius < martynas.mickevic...@typesafe.com> wrote: > Hi, > > you can do that using scan with something like this (not compiled): > > flow.scan(zero = (0, 0)) { > case ((prevScan, prevElem), elem) => (prevScan, elem) > } > Almost, you missed the agg

Re: [akka-user] scan and map

2016-01-29 Thread Martynas Mickevičius
Hi, you can do that using scan with something like this (not compiled): flow.scan(zero = (0, 0)) { case ((prevScan, prevElem), elem) => (prevScan, elem) } On Thu, Jan 28, 2016 at 6:05 PM, Richard Rodseth wrote: > In akka-streams, scan is like fold, in that it takes a zero and a function > to

[akka-user] scan and map

2016-01-28 Thread Richard Rodseth
In akka-streams, scan is like fold, in that it takes a zero and a function to do the accumulating, but it emits each accumulated value rather than the final result. But what if I wanted to emit tuples of the accumulated value and the stream element? Is there an operator I've missed or would scanM