Commit b9ca1d0d authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2002-10-21 22:24:44 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-21 22:24:44+00:00
parent 99e07363
type Person = FPerson | MPerson;;
type FPerson = <person gender="F">[ Name Children ];;
type MPerson = <person gender="M">[ Name Children ];;
type Children = <children>[Person*];;
type Name = <name>[String];;
type Man = <man>[ Name Sons Daughters ];;
type Woman = <woman>[ Name Sons Daughters ];;
type Sons = <sons>[ Man* ];;
type Daughters = <daughters>[ Woman* ];;
let fun sort (MPerson \(\synarrow\) Man ; FPerson \(\synarrow\) Woman)
<person gender=g>[ n <children>[(mc::MPerson | fc::FPerson)*] ] \mred
let tag = match g with "M" \mred `man | "F" \mred `woman in
let s = map mc with x \mred sort x in
let d = map fc with x \mred sort x in
<(tag)>[ n <sons>s <daughters>d ];;
\ No newline at end of file
type Company = <company>[ Worker* ];;
type Worker = <worker>[Surname Name Salary];;
type Surname = <surname>[String];;
type Name = <name>[String];;
type Salary = <salary>[Int];;
type PlusQueMoi = 1000;;
let my_company =
<company>[
<worker>[
<surname>["Durand"]
<name>["Paul"]
<salary>["6500"]
]
<worker>[
<surname>["Dupond"]
<name>["Jean"]
<salary>[1800]
]
<worker>[
<surname>["Martin"]
<name>["Jules"]
<salary>[1800]
]
] in
let q1 = let <company> x = my_company in
(map x with <worker>[x y z ] -> <worker>[x y]) in
let q2 = let <company>[(x::<worker>[ Any Any PlusQueMoi ])*] = my_company in
(map x with <worker>[x y z ] -> <worker>[x y]) in
(q1,q2);;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment