Commit 8061cfdb authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2002-10-21 22:28:49 by cvscast] Empty log message

Original author: cvscast
Date: 2002-10-21 22:31:15+00:00
parent b9ca1d0d
type Person = FPerson | MPerson;;
type FPerson = <person gender="F">[ Name Children ];;
type MPerson = <person gender="M">[ Name Children ];;
type FPerson = <person gender=1>[ Name Children ];;
type MPerson = <person gender=2>[ Name Children ];;
type Children = <children>[Person*];;
type Name = <name>[String];;
......@@ -9,9 +9,9 @@ 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
let fun sort (MPerson -> Man ; FPerson -> Woman)
<person gender=g>[ n <children>[(mc::MPerson | fc::FPerson)*] ] ->
let tag = match g with 1 -> `woman | 2 -> `man in
let s = map mc with x -> sort x in
let d = map fc with x -> sort x in
<(tag)>[ n <sons>s <daughters>d ] in sort;;
\ No newline at end of file
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