Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
ff3a9aac
Commit
ff3a9aac
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2002-12-01 20:52:33 by cvscast] Empty log message
Original author: cvscast Date: 2002-12-01 20:52:33+00:00
parent
31583d6e
Changes
2
Show whitespace changes
Inline
Side-by-side
tests/addrbook.cd
View file @
ff3a9aac
...
...
@@ -15,6 +15,7 @@ type Tel = <tel>[ PCDATA ];;
<addr>"Scotland"
];;
(* converting an address book into a telephone list *)
fun mkTelList ([ (Name Addr Tel?)* ] -> [ (Name Tel)* ])
...
...
@@ -27,6 +28,7 @@ fun mkTelList (Addrbook -> [ (Name Tel)* ])
<_>[ ( ( (x::Name) Addr (x::Tel) ) | _ )* ] -> x
;;
fun (Int -> Addrbook) x ->
<addrbook>[
<name>"Haruo Hosoya"
...
...
@@ -39,6 +41,7 @@ fun (Int -> Addrbook) x ->
]
;;
match <addrbook>[
<name>"Haruo Hosoya"
<addr>"Tokyo"
...
...
@@ -50,8 +53,10 @@ match <addrbook>[
] with
<_>[ ( ( (x::Name) Addr (x::Tel) ) | _ )* ] -> x;;
(*
(*
(* the pattern extract the full sequence of subelements *)
match ex with addrbook:[;a] -> mkTelList a;;
*)
*)
types/patterns.ml
View file @
ff3a9aac
...
...
@@ -999,7 +999,9 @@ struct
if
x
==
ab
then
aux_ab
else
aux
x
fields
))
pr
in
`Label
(
l1
,
pr
,
aux_ab
)
|
_
->
assert
false
(* TODO:!!!*)
|
((
`NoField
|
`SomeField
)
,_
)
->
aux
`Success
fields
in
let
line
accu
((
res
,
fields
)
,
acc
)
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment