type Person = FPerson | MPerson;; type FPerson = [ Name Children ];; type MPerson = [ Name Children ];; type Children = [Person*];; type Name = [String];; type Man = [ Name Sons Daughters ];; type Woman = [ Name Sons Daughters ];; type Sons = [ Man* ];; type Daughters = [ Woman* ];; let fun sort (MPerson -> Man ; FPerson -> Woman) [ n [(mc::MPerson | fc::FPerson)*] ] -> let tag = match g with ["F"] -> `woman | ["M"] -> `man in let s = map mc with (x & MPerson) -> sort x in let d = map fc with x -> sort x in <(tag)>[ n s d ] in sort;;