Refactored to allow ConceptEvaluator
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
class Concept:
|
||||
* name
|
||||
|
||||
human reading name of the concept. It is how the concept will be referenced
|
||||
* is_builtin
|
||||
|
||||
Simple flag to make the difference between user defined concept and builtins
|
||||
|
||||
* is_unique
|
||||
|
||||
To manage singleton. There should be only one instance of the concept if True
|
||||
|
||||
* key
|
||||
|
||||
It is the name of the concept, where all variables, or the obj are replaced by
|
||||
__var__x (x is the number of the variable). It's use to quickly find concepts
|
||||
with variables
|
||||
|
||||
* id
|
||||
|
||||
The key is the unique identifier for the class of concept. The concept may be
|
||||
modified along its life, but its key will never change
|
||||
|
||||
* where
|
||||
|
||||
preconditions for the variables of the concept. Body will be executed only
|
||||
if the where conditions on the properties are True
|
||||
|
||||
* pre
|
||||
|
||||
Execution context to verified before executing the context
|
||||
|
||||
* post
|
||||
|
||||
Post conditions to verify, once the context is executed
|
||||
|
||||
* obj
|
||||
|
||||
main or principal subject of the concept
|
||||
|
||||
* body
|
||||
|
||||
Code or value of the concept
|
||||
|
||||
* desc
|
||||
|
||||
explanation of the concept
|
||||
|
||||
* digest
|
||||
|
||||
SHA 256 of all properties. It allows
|
||||
|
||||
* props
|
||||
|
||||
other properties of the concept (obj is the first one)
|
||||
|
||||
+15
-1
@@ -382,4 +382,18 @@ so I can type
|
||||
1 + 1
|
||||
sheerka.test()
|
||||
|
||||
I will now work on how to call an already defined concept.
|
||||
I will now work on how to call an already defined concept.
|
||||
|
||||
|
||||
2019-11-11
|
||||
**********
|
||||
|
||||
Maintaining the blog
|
||||
""""""""""""""""""""
|
||||
It's not very easy to maintain this blog. Every time I have some time to work on **Sheerka**,
|
||||
I must choose between expressing my ideas in this blog and coding.
|
||||
|
||||
I have plenty of ideas that I would like to express, sometimes just to put the idea down,
|
||||
but I lack of time. It would be great if I can find a tool that will allow me to just to
|
||||
dictate my words. I know that there are plenty out there, I need to spend some time to test
|
||||
them and choose one.
|
||||
+15
-4
@@ -1,6 +1,10 @@
|
||||
In this example, I try to think of how I can deal with errors
|
||||
```
|
||||
> "hello
|
||||
-> unfinished quote "
|
||||
|
||||
create a concept to recognize the error
|
||||
|
||||
> def concept unfinished quote q
|
||||
... where:
|
||||
...... q in ('"', '"')
|
||||
@@ -9,9 +13,16 @@
|
||||
... input = sheerka.last_input
|
||||
|
||||
|
||||
Create the rule to manage the error
|
||||
|
||||
> when unfinished quote q as c:
|
||||
... add rule as:
|
||||
...... if q in sheerka.input:
|
||||
... add rule r as:
|
||||
...... if q is last of sheerka.input:
|
||||
......... sheerka.resume(c, c.input + input)
|
||||
......... remove rule
|
||||
```
|
||||
......... remove r
|
||||
|
||||
def concept a is last of b as:
|
||||
where b is list
|
||||
as b[-1] == a
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user