0

I have a c.Expr[Seq[T]] and I want to get a Seq[c.Expr[T]] so I can pass it to a library function that processes it and produces a different final result Expr.

I found this answer explaining how to go in the opposite direction but I can't quite figure out how to invert the process.

reify { xs.splice.map(x => reify { x }) } gives me c.Expr[Seq[c.Expr[T]]], which isn't quite right.

Community
  • 1
  • 1
Leo
  • 3,036
  • 3
  • 13
  • 12
  • You may have a bit of a problem here: not every `c.Expr[Seq[T]]` can get transformed to a `Seq[c.Expr[T]]`. For example, `(List(1,2,3) ++ List(4,5)).toSeq` is a `c.Expr[Seq[T]]`, but there is no obvious `Seq[c.Expr[T]]` to get from it. Do you maybe mean just targeting expressions of the form `Seq(1,2,3,4)` (so the apply method of the companion object)? – Alec Sep 29 '16 at 05:01
  • Also, is there any reason to be using `Expr` instead of `Tree`s? While I think it ought to be possible to return `Seq[Expr[T]]`, it will be much harder than just doing everything with `Tree`. – Alec Sep 29 '16 at 05:36
  • In the case of `List1 ++ List2` I'd like to eval the expression, then map `reify` over the resultant `Seq`. The reason I'm using Expr is to hook into some existing macro helpers in a library. – Leo Sep 30 '16 at 01:24

0 Answers0