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

// Define some basic things about mountains.
// Note the use of quotes to introduce terms.

theory "mountain" [
  a mountain has a "peak".
  a mountain has a "height above sea level".
  if a mountain's "height above sea level" is X then the mountain's peak is X above "sea level".
]

// A test case (an expected dialog) that the theories can be
// automatically checked against.

test "what is a mountain" [
  on [a mountain is a big thing] say [[ok a mountain is a big thing] [i will remember that]]
  on [what is a mountain] say [a mountain is a big thing]
  on [name a mountain] say [i dont' know any mountains]
  on [everest is a mountain] say [[ok everest is a mountain] [i will remember that]]
  on [name a mountain] say [everest]
  on [is everest a mountain] say [yes]
  on [is everest a goat] say [i don't know]
  on [is georgia a mountain] say [i don't know]
]

// Define the plural of many words (for writing answers)

theory "simple plural" [
  if   [concat(Mountain,"s") = Mountains]
  then [the plural of Mountain is Mountains]
]

// Some logic about mountains

theory "mountains and peaks" [
  if   [M is a mountain]
  then [M has a "peak"]
]

// An extremely general logic rule that should be present at all
// times.

theory "is a, has a" [
  if   [M is a X]
  and  [a X has a Y]
  then [M has a Y]
]

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: 511 / 361
Referenced in: [show references]