Introduced ConceptsAlgebra
This commit is contained in:
+8
-11
@@ -1,4 +1,6 @@
|
||||
#import admin
|
||||
|
||||
# define numbers
|
||||
def concept one as 1
|
||||
def concept two as 2
|
||||
def concept three as 3
|
||||
@@ -75,12 +77,13 @@ set_isa(one hundred, number)
|
||||
def concept hundreds from bnf number=n1 'hundred' 'and' number=n2 where n1 < 10 and n2 < 100 as n1 * 100 + n2
|
||||
set_isa(hundreds, number)
|
||||
def concept hundreds from bnf number 'hundred' where number < 10 as number * 100
|
||||
last_created_concept() is number
|
||||
set_isa(last_created_concept(), number)
|
||||
def concept thousands from bnf number 'thousand' where number < 1000 as number * 1000
|
||||
set_isa(thousands, number)
|
||||
def concept thousands from bnf number=n1 'thousand' 'and' number=n2 as n1 * 1000 + n2 where n1 < 1000 and n2 < 1000
|
||||
last_created_concept() is number
|
||||
def concept history as history()
|
||||
set_isa(last_created_concept(), number)
|
||||
|
||||
# define basic operations on numbers
|
||||
def concept plus from a plus b as a + b
|
||||
def concept minus from a minus b as a - b
|
||||
def concept multiplied from a multiplied by b as a * b
|
||||
@@ -89,11 +92,5 @@ set_is_greater_than(__PRECEDENCE, multiplied, plus)
|
||||
set_is_greater_than(__PRECEDENCE, divided, plus)
|
||||
set_is_greater_than(__PRECEDENCE, multiplied, minus)
|
||||
set_is_greater_than(__PRECEDENCE, divided, minus)
|
||||
def concept precedence a > precedence b as set_is_greater_than(__PRECEDENCE, a, b)
|
||||
set_isa(c:precedence a > precedence b:, __AUTO_EVAL)
|
||||
def concept x is a command as set_isa(x, __AUTO_EVAL)
|
||||
set_isa(c:x is a command:, __AUTO_EVAL)
|
||||
def concept q from q ? as question(q) pre is_question()
|
||||
set_is_lesser(__PRECEDENCE, q)
|
||||
def concept x is a 'concept' as isinstance(x, Concept) pre is_question()
|
||||
def concept x is a y as isa(x,y) pre is_question()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user