Just think about the simplest situation, that is, there is only one node in the org chart. For example,
let t = Memoized.(Node (100, "Vincent", Empty, Empty, ref None))
Then in party t, obviously party_in t wins. Let's dive into party_in t. Obviously party_out l and party_out r both return (0, []), so party_in t will return (v + 0 + 0, name :: [] @ []), that is, (100, ["Vincent"]). Go back to party t
if infun > outfun then (v + infun, name :: innames)
else (outfun, outnames)
it will return (200, ["Vincent", "Vincent"]), which is obviously wrong.
fix https://github.com/cs3110/textbook/issues/37
Just think about the simplest situation, that is, there is only one node in the org chart. For example,
Then in
party t
, obviouslyparty_in t
wins. Let's dive intoparty_in t
. Obviouslyparty_out l
andparty_out r
both return(0, [])
, soparty_in t
will return(v + 0 + 0, name :: [] @ [])
, that is,(100, ["Vincent"])
. Go back toparty t
it will return
(200, ["Vincent", "Vincent"])
, which is obviously wrong.