#lang racket
(require "data-structures.rkt")
(provide debug)
(define (safe-literal-dec-lev literal)
(let ((node (var-igraph-node (literal-var literal))))
(if node
(node-dec-lev node)
'U)))
(define (pretty-print item)
(cond
[(clause? item) (vector-map (lambda (lit) (pretty-print lit)) (clause-literals item))]
[(vector? item) (vector-map (lambda (lit) (pretty-print lit)) item)]
[(literal? item) (if (literal-polarity item)
(format "~s[~s]" (var-name (literal-var item)) (safe-literal-dec-lev item))
(format "-~s[~s]" (var-name (literal-var item)) (safe-literal-dec-lev item)))]
[(pair? item)
(cons (pretty-print (car item))
(pretty-print (cdr item)))]
[(node? item)
(format "~a >> "
(pretty-print (node-antecedent item)))]
[else item]))
(define (debug msg . items)
(begin (printf "~a: ~a~%" msg (string-join (map (λ (i) (format "~a" i)) (map pretty-print items)) "\n "))
items))
(define-syntax debug
(syntax-rules ()
[(_ x y) '*void*]))