/[svn]/tests/overloading.cd
ViewVC logotype

Contents of /tests/overloading.cd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (hide annotations)
Tue Jul 10 16:59:39 2007 UTC (5 years, 10 months ago) by abate
File size: 719 byte(s)
[r2002-10-21 22:24:44 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-21 22:24:44+00:00
1 abate 34 type Person = FPerson | MPerson;;
2     type FPerson = <person gender="F">[ Name Children ];;
3     type MPerson = <person gender="M">[ Name Children ];;
4     type Children = <children>[Person*];;
5     type Name = <name>[String];;
6    
7     type Man = <man>[ Name Sons Daughters ];;
8     type Woman = <woman>[ Name Sons Daughters ];;
9     type Sons = <sons>[ Man* ];;
10     type Daughters = <daughters>[ Woman* ];;
11    
12     let fun sort (MPerson \(\synarrow\) Man ; FPerson \(\synarrow\) Woman)
13     <person gender=g>[ n <children>[(mc::MPerson | fc::FPerson)*] ] \mred
14     let tag = match g with "M" \mred `man | "F" \mred `woman in
15     let s = map mc with x \mred sort x in
16     let d = map fc with x \mred sort x in
17     <(tag)>[ n <sons>s <daughters>d ];;

CVS Admin">CVS Admin
ViewVC Help
Powered by ViewVC 1.1.5