forked from GitHub/gf-core
gf-book web page index and toc
This commit is contained in:
10
gf-book/examples/chapter7/Map.gf
Normal file
10
gf-book/examples/chapter7/Map.gf
Normal 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 ;
|
||||
}
|
||||
17
gf-book/examples/chapter7/MapEng.gf
Normal file
17
gf-book/examples/chapter7/MapEng.gf
Normal 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 ++ ")"} ;
|
||||
}
|
||||
12
gf-book/examples/chapter7/Query.gf
Normal file
12
gf-book/examples/chapter7/Query.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
abstract Query = {
|
||||
flags startcat=Question ;
|
||||
cat
|
||||
Answer ; Question ; Object ;
|
||||
fun
|
||||
Even : Object -> Question ;
|
||||
Odd : Object -> Question ;
|
||||
Prime : Object -> Question ;
|
||||
Number : Int -> Object ;
|
||||
Yes : Answer ;
|
||||
No : Answer ;
|
||||
}
|
||||
13
gf-book/examples/chapter7/QueryEng.gf
Normal file
13
gf-book/examples/chapter7/QueryEng.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
concrete QueryEng of Query = {
|
||||
lincat
|
||||
Answer, Question, Object = Str ;
|
||||
lin
|
||||
Even = pred "even" ;
|
||||
Odd = pred "odd" ;
|
||||
Prime = pred "prime" ;
|
||||
Number i = i.s ;
|
||||
Yes = "yes" ;
|
||||
No = "no" ;
|
||||
oper
|
||||
pred : Str -> Str -> Str = \f,x -> "is" ++ x ++ f ;
|
||||
}
|
||||
13
gf-book/examples/chapter7/QueryFin.gf
Normal file
13
gf-book/examples/chapter7/QueryFin.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
concrete QueryFin of Query = {
|
||||
lincat
|
||||
Answer, Question, Object = Str ;
|
||||
lin
|
||||
Even = pred "parillinen" ;
|
||||
Odd = pred "pariton" ;
|
||||
Prime = pred "alkuluku" ;
|
||||
Number i = i.s ;
|
||||
Yes = "kyllä" ;
|
||||
No = "ei" ;
|
||||
oper
|
||||
pred : Str -> Str -> Str = \f,x -> "onko" ++ x ++ f ;
|
||||
}
|
||||
Reference in New Issue
Block a user