Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

45
LINES

< > BotCompany Repo | #1002764 // Some Theories About Mountains (Exhibit A)

Microtheory

1  
// Define some basic things about mountains.
2  
// Note the use of quotes to introduce terms.
3  
4  
theory "mountain" [
5  
  a mountain has a "peak".
6  
  a mountain has a "height above sea level".
7  
  if a mountain's "height above sea level" is X then the mountain's peak is X above "sea level".
8  
]
9  
10  
// A test case (an expected dialog) that the theories can be
11  
// automatically checked against.
12  
13  
test "what is a mountain" [
14  
  on [a mountain is a big thing] say [[ok a mountain is a big thing] [i will remember that]]
15  
  on [what is a mountain] say [a mountain is a big thing]
16  
  on [name a mountain] say [i dont' know any mountains]
17  
  on [everest is a mountain] say [[ok everest is a mountain] [i will remember that]]
18  
  on [name a mountain] say [everest]
19  
  on [is everest a mountain] say [yes]
20  
  on [is everest a goat] say [i don't know]
21  
  on [is georgia a mountain] say [i don't know]
22  
]
23  
24  
// Define the plural of many words (for writing answers)
25  
26  
theory "simple plural" [
27  
  if   [concat(Mountain,"s") = Mountains]
28  
  then [the plural of Mountain is Mountains]
29  
]
30  
31  
// Some logic about mountains
32  
33  
theory "mountains and peaks" [
34  
  if   [M is a mountain]
35  
  then [M has a "peak"]
36  
]
37  
38  
// An extremely general logic rule that should be present at all
39  
// times.
40  
41  
theory "is a, has a" [
42  
  if   [M is a X]
43  
  and  [a X has a Y]
44  
  then [M has a Y]
45  
]

download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002764
Snippet name: Some Theories About Mountains (Exhibit A)
Eternal ID of this version: #1002764/1
Text MD5: ae288df1e512084f8614633b6433e55b
Author: stefan
Category: javax
Type: Microtheory
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-23 02:27:14
Source code size: 1362 bytes / 45 lines
Pitched / IR pitched: No / No
Views / Downloads: 595 / 386
Referenced in: [show references]