/[svn]/cduce/trunk/benchmarks/addrbook2.q
ViewVC logotype

Contents of /cduce/trunk/benchmarks/addrbook2.q

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1956 - (hide annotations)
Wed Jul 11 13:01:15 2007 UTC (5 years, 10 months ago) by abate
File size: 616 byte(s)
new svn layout

1 abate 490 import "xml.q"
2    
3     type Addrbook = addrbook[Person*]
4     type Person = person[(Name,Tel?,Email* )]
5     type Name = name[String]
6     type Tel = tel[String]
7     type Email = email[String]
8    
9     fun mkTelbook (val ps as Person* ) : entry[(Name,Tel)]* =
10     filter ps {
11     ( person[name[val n], tel[val t], val e]
12     { entry[name[n], tel[t]] }
13     | person[name[val n], val e as Email*]
14     { () }
15     )*
16     }
17    
18     let val _ =
19     match argv() with
20     val fn as String ->
21     ( match load_xml(fn) with
22     addrbook[val p as Person*] -> mkTelbook(p)
23     | Any -> raise("Invalid document") )
24     | Any -> raise("Invalid command line")

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