/usr/share/racket/pkgs/datalog/eval.rkt is in racket-common 6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #lang racket/base
(require racket/list
racket/contract
"ast.rkt"
"pretty.rkt"
"runtime.rkt")
(define current-theory (make-parameter (make-theory)))
(define (assume-if-safe assume thy s)
(let ([c (assertion-clause s)])
(if (safe-clause? c)
(assume thy c)
(raise-syntax-error 'datalog
"Unsafe clause in assertion"
(datum->syntax #f (format-statement s) (assertion-srcloc s))))))
(define (print-questions ls)
(displayln
(format-questions ls)))
(define (eval-program p)
(for-each eval-top-level-statement p))
(define (eval-top-level-statement s)
(define v (eval-statement s))
(unless (void? v)
(print-questions v)))
(define (eval-statement s)
(cond
[(assertion? s)
(assume-if-safe assume! (current-theory) s)]
[(retraction? s)
(retract! (current-theory) (retraction-clause s))]
[(query? s)
(prove (current-theory) (query-question s))]))
(provide/contract
[current-theory (parameter/c theory/c)]
[print-questions ((listof question/c) . -> . void)]
[eval-program (program/c . -> . void)]
[eval-top-level-statement (statement/c . -> . void)]
[eval-statement (statement/c . -> . (or/c void (listof question/c)))])
|