First implementation of questions management

This commit is contained in:
2020-08-14 08:16:33 +02:00
parent e84b394da2
commit 351c16f946
47 changed files with 1582 additions and 400 deletions
+15 -1
View File
@@ -81,6 +81,20 @@ def concept thousands from bnf number=n1 'thousand' 'and' number=n2 as n1 * 1000
last_created_concept() is number
def concept history as history()
def concept plus from a plus b as a + b
def concept mult from a mult b as a * b
def concept minus from a plus b as a - b
def concept multiplied from a multiplied by b as a * b
def concept divided from a divided by b as a * b
set_is_greater_than(BuiltinConcepts.PRECEDENCE, multiplied, plus)
set_is_greater_than(BuiltinConcepts.PRECEDENCE, divided, plus)
set_is_greater_than(BuiltinConcepts.PRECEDENCE, multiplied, minus)
set_is_greater_than(BuiltinConcepts.PRECEDENCE, divided, minus)
def concept explain as get_results() | filter("id == 0") | recurse(2)
def concept explain last as get_last_results() | filter("id == 0") | recurse(2)
set_isa(c:explain:, __COMMAND)
set_isa(c:explain last:, __COMMAND)
def concept precedence a > precedence b as set_is_greater_than(BuiltinConcepts.PRECEDENCE, a, b)
set_isa(c:precedence a > precedence b:, __COMMAND)
def concept x is a command as set_isa(x, __COMMAND)
set_isa(c:x is a command:, __COMMAND)
def concept q from q ? as question(q) pre in_context(BuiltinConcepts.EVAL_QUESTION_REQUESTED)
def concept x is a 'concept' as isinstance(x, Concept) pre in_context(BuiltinConcepts.EVAL_QUESTION_REQUESTED)