1 Embedded Parenlog
The easiest way to get started using Parenlog for Racket is with the main module:
(require parenlog) | package: parenlog |
Here is a basic example of using Parenlog:
Examples: | |||||||||||||||||||||||||||||||||||
|
syntax
(define-model id stmt ...)
stmt = head-query | (:- head-query body-query ...) head-query = s-expr body-query = s-expr | (,fun s-expr ...)
id : identifier?
fun : (any/c ... -> boolean?)
Defines id as a Parenlog model.
syntax
Syntax that may only appear within define-model.
syntax
(query-model model-expr maybe-limit body-query)
maybe-limit =
| #:limit limit-expr
model-expr : model?
limit-expr : number?
Queries model-expr with body-query until limit-expr results are found
or no results remain.
Returns a value matching the contract: (listof (hash/c symbol? anc/c)). Each value in this list is a substitution of body-query that model-expr proves.