3 ms·
You would lose the performance optimisations of a copy, but you can still express tests in this tree fashion with global state. You just need to recurs the tree
by James_K 2y ago
You would lose the performance optimisations of a copy, but you can still express tests in this tree fashion with global state. You just need to recurs the tree from the top down and run the entire path up to each node. A simple example:
test_fork<A, B, C>(a: A, f: (A) -> B, gs: List<(B) -> C>) -> List<C> {
fs.map(g -> g(f(a)))
}
As you can see, the first step of the test is re-run from scratch every other branch of it.