Suchbäume: Durchlaufen

Inorder-Durchquerung der Knoten:

nodes :: Tree a -> [a]
nodes t = case t of
    Leaf     -> []
    Node { } -> nodes (left t) 
             ++ [ key t ]
             ++ nodes (right t)

Sortieren:

sort :: [ Int ] -> [ Int ]
sort xs = nodes ( make xs )

variablenfreie Schreibweise durch Komposition von Funktionen:

sort = nodes . make
Aufgabe: welche Typ hat (.) ?



Johannes Waldmann 2004-11-30