Converting a tree

In your code, [x], bt_to_list lt, and bt_to_list rt all have type 'a list. However, you are using :: to append 'a list with another 'a list.

The fix is using list concatenation operator @: (x :: (bt_to_list lt)) @ (bt_to_list rt)

1 Like