@@ -298,20 +298,20 @@ object Test {
298
298
/** A stream containing the first `n` elements of this stream. */
299
299
def take (n : Expr [Int ]): Stream [A ] = Stream (takeRaw[Expr [A ]](n, stream))
300
300
301
- private def zipRaw [A : Type , B : Type ](stream1 : StagedStream [A ] , stream2 : StagedStream [B ]): StagedStream [(A , B )] = {
301
+ private def zipRaw [A : Type , B : Type ](stream1 : StagedStream [Expr [ A ]] , stream2 : StagedStream [B ]): StagedStream [(Expr [ A ] , B )] = {
302
302
(stream1, stream2) match {
303
303
304
304
case (Linear (producer1), Linear (producer2)) =>
305
305
Linear (zip_producer(producer1, producer2))
306
306
307
307
case (Linear (producer1), Nested (producer2, nestf2)) =>
308
- pushLinear[A , _, B ](producer1, producer2, nestf2)
308
+ pushLinear[Expr [ A ] , _, B ](producer1, producer2, nestf2)
309
309
310
310
case (Nested (producer1, nestf1), Linear (producer2)) =>
311
- mapRaw[(B , A ), (A , B )]((t => k => ' { ~ k((t._2, t._1)) }), pushLinear[B , _, A ](producer2, producer1, nestf1))
311
+ mapRaw[(B , Expr [ A ] ), (Expr [ A ] , B )]((t => k => ' { ~ k((t._2, t._1)) }), pushLinear[B , _, Expr [ A ] ](producer2, producer1, nestf1))
312
312
313
313
case (Nested (producer1, nestf1), Nested (producer2, nestf2)) =>
314
- zipRaw(Linear (makeLinear(stream1)), stream2)
314
+ zipRaw(Linear (makeLinear[ A ] (stream1)), stream2)
315
315
}
316
316
}
317
317
@@ -321,7 +321,7 @@ object Test {
321
321
* @tparam A
322
322
* @return
323
323
*/
324
- private def makeLinear [A : Type ](stream : StagedStream [A ] ): Producer [A ] = {
324
+ private def makeLinear [A : Type ](stream : StagedStream [Expr [ A ]] ): Producer [Expr [ A ] ] = {
325
325
stream match {
326
326
case Linear (producer) => producer
327
327
case nested : Nested [A , bt] => {
@@ -370,7 +370,7 @@ object Test {
370
370
}
371
371
}
372
372
373
- new Producer [A ] {
373
+ new Producer [Expr [ A ] ] {
374
374
// _1: if the stream has ended,
375
375
// _2: the current element,
376
376
// _3: the step of the inner most steam
@@ -382,24 +382,23 @@ object Test {
382
382
Var (' { (_ : Unit ) => ()}){ advf => {
383
383
Var (' { true }) { hasNext => {
384
384
Var (' { null .asInstanceOf [A ] }) { curr => ' {
385
+ val adv : Unit => Unit = { _ =>
386
+ ~ hasNext.update(producer.hasNext(st))
387
+ if (~ hasNext.get) {
388
+ // ~producer.step(st, (el: bt) => makeAdvanceFunction[Expr[A]](advf, (a => curr.update(a)), nestedf(el)))
389
+ }
390
+ }
385
391
386
- // val adv: Unit => Unit = {
387
- // ~hasNext.update(producer.hasNext(st))
388
- // if(~hasNext.get) {
389
- // ~producer.step(st, (el: bt) => makeAdvanceFunction[Expr[A]](advf, (a => curr.update(a)), nestedf(el)))
390
- // }
391
- // }
392
-
393
- // ~advf.update('{adv})
394
- // adv(_)
392
+ ~ advf.update(' {adv})
393
+ adv(())
395
394
396
395
~ k((hasNext, curr, advf))
397
396
}}
398
397
}}
399
398
}})
400
399
}
401
400
402
- def step (st : St , k : A => Expr [Unit ]): Expr [Unit ] = ???
401
+ def step (st : St , k : Expr [ A ] => Expr [Unit ]): Expr [Unit ] = ???
403
402
404
403
def hasNext (st : St ): Expr [Boolean ] = ???
405
404
}
@@ -467,7 +466,7 @@ object Test {
467
466
468
467
val Stream (stream_b) = stream2
469
468
470
- Stream (mapRaw[(Expr [A ], Expr [B ]), Expr [C ]]((t => k => ' { ~ k(f(t._1)(t._2)) }), zipRaw[Expr [ A ] , Expr [B ]](stream, stream_b)))
469
+ Stream (mapRaw[(Expr [A ], Expr [B ]), Expr [C ]]((t => k => ' { ~ k(f(t._1)(t._2)) }), zipRaw[A , Expr [B ]](stream, stream_b)))
471
470
}
472
471
}
473
472
0 commit comments