["mov a 1","mov b 1","mov c 0","mov d 26","jnz c 2","jnz 1 5","mov c 7","inc d","dec c","jnz c -2","mov c a","inc a","dec b","jnz b -2","mov b c","dec d","jnz d -6","mov c 18","mov d 11","inc a","dec d","jnz d -2","dec c","jnz c -5"]
What's the type of foldRoseTree? According to the simple test cases I implemented the foldRoseTree with type (a -> [b] -> b) -> (b -> [b] -> [b]) -> [b] -> RoseTree a -> b, but there is a function roseDepth = foldRoseTree (const (+ 1)) max 0 in truly test cases, which is conflict with simple test cases.
You can do it by changing your bound github profile picture
They do not conflict, the second function is simply more general then the first one. Try to squeeze in one more type variable into your definition.
What's the type of
foldRoseTree
? According to the simple test cases I implemented thefoldRoseTree
with type(a -> [b] -> b) -> (b -> [b] -> [b]) -> [b] -> RoseTree a -> b
, but there is a functionroseDepth = foldRoseTree (const (+ 1)) max 0
in truly test cases, which is conflict with simple test cases.This comment is hidden because it contains spoiler information about the solution