if i understand correctly, you can thread all required additional values
through scanLeft as well, for example:
val nipp2 = fisk.scanLeft((start, true)) { case ((prev, prevSet), cur) =>
val ret = Po(cur.c, Some(prevSet))
(ret, prevSet && cur.on.contains(true))
}
This simple example has the cost of adding another value to each element
in the list. This can be improved by creating a better type than a tuple
(maybe Acc(list: List[Po], prevSet: Boolean) so you only have one
additional property as in the var case. The basic concept is, that
everything you need inside the scanLeft has to “come in” as argument
somehow.
Not sure if I understood correctly, hope it helps…