let examples = [ "ovfun"," type Person = FPerson | MPerson;; type FPerson = [ Name Children (Tel | Email)?];; type MPerson = [ Name Children (Tel | Email)?];; type Children = [Person*];; type Name = [ PCDATA ];; type Tel = ['0'--'9'+ '-' '0'--'9'+];; type Email = [PCDATA '@' PCDATA];; type Man = [ Sons Daughters ];; type Woman = [ 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 -> sort x in let d = map fc with x -> sort x in <(tag) name=n>[ s d ] ;; let base : Person = [ \"Claude\" [ [ \"Véronique\" [ [ \"Ilaria\" [] ] ] \"314-1592654\" ] ] \"271-828182\" ] ;; sort base;; ";"note"," type Doc = Text;; type Text = [ (Char | (Letter+ ' '* Note))* ];; type Letter = 'a'--'z' | 'A'--'Z';; type Note = [ PCDATA ];; type Flow = [ (Char | [ PCDATA ])* ];; type Notes = [ [ PCDATA ]* ];; type Result = [ Flow Notes ];; let fun format (s : Doc) : Result = let (body,notes) = text (s,1) in [ body notes ];; let fun text ( (Text,Int) -> (Flow,Notes) ) | ([ pre::Char*? (word::Letter+ ' '* n); rem ], count) -> let (body,notes) = text (rem, count + 1) in (pre @ [word] @ body, [n] @ notes) | (body,_) -> (body, []);; let src : Doc = [ 'CDuce ' \"Frisch, Castagna, Benzaken\" ' is an XML ' \"a W3C standard\" '-friendly programming language.' ];; format src;; "; ];; let present = "
  • Overloaded functions.This examples demonstrates the use of overloaded functions.
  • Footnotes. This example shows how to bind an XML element with surrounding text.
";;