completed book examples

This commit is contained in:
aarne
2010-11-22 15:48:52 +00:00
parent 76ba03b545
commit 67176f1520
11 changed files with 110 additions and 9 deletions

View File

@@ -0,0 +1,10 @@
abstract Map = {
flags startcat = Query ;
cat
Query ; Input ; Place ; Click ;
fun
GoFromTo : Place -> Place -> Input ;
ThisPlace : Click -> Place ;
QueryInput : Input -> Query ;
ClickCoord : Int -> Int -> Click ;
}

View File

@@ -0,0 +1,17 @@
concrete MapEng of Map = {
lincat
Query = {s : Str} ;
Input, Place = {s : Str ; p : Str} ;
Click = {p : Str} ;
lin
GoFromTo x y = {
s = "I want to go from" ++ x.s ++ "to" ++ y.s ;
p = x.p ++ y.p
} ;
ThisPlace c = {
s = "this place" ;
p = c.p
} ;
QueryInput i = {s = i.s ++ ";" ++ i.p} ;
ClickCoord x y = {p = "(" ++ x.s ++ "," ++ y.s ++ ")"} ;
}