Programmtransformationen (II)

make (x : xs) = 
   let ( low, high ) = partition ( < x ) xs
   in  Node { key   = x
            , left  = make low
            , right = make high
            }
nodes ( Node { } ) =
    nodes (left t) ++ [ key t ] ++ nodes (right t)

sort (x : xs) = nodes (make (x : xs)) = 
   let ( low, high ) = partition ( < x ) xs
   in  nodes (make low) ++ [ x ] ++ nodes (make high)
sort (x : xs) = 
   let ( low, high ) = partition ( < x ) xs
   in  sort low ++ [ x ] ++ sort high



Johannes Waldmann 2004-11-30