Skip to content

Commit

Permalink
README: provide working example
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
  • Loading branch information
noxdafox committed Jul 20, 2022
1 parent 4043f52 commit 625e640
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,19 @@ Example
(slot birthdate (type SYMBOL)))
"""
environment = clips.Environment()
DEFRULE_STRING = """
(defrule hello-world
"Greet a new person."
(person (name ?name) (surname ?surname))
=>
(println "Hello " ?name " " ?surname))
"""
# load constructs into the environment from a file
environment.load('constructs.clp')
environment = clips.Environment()
# define a fact template
# define constructs
environment.build(DEFTEMPLATE_STRING)
environment.build(DEFRULE_STRING)
# retrieve the fact template
template = environment.find_template('person')
Expand Down

0 comments on commit 625e640

Please sign in to comment.