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 . makeAufgabe: welche Typ hat
(.) ?