Scheme? -> cKanren

usage

(run* (x) 
   (== x 3)
   (scm?->ck number? x));=>(3)

(run* (x) 
   (scm?->ck number? x) ;;project does not work in this order 
   (== x 3))  ;=>(3)

(run* (x) 
   (== x 'a)
   (scm?->ck number? x));=>'()


(run* (q) 
      (fresh (x y)
      (== x 3)
      (== y 5)
      (scm?->ck <  x y) ;;; x < y
      (conso x y q)
      )) ;=> '((3 . 5))


(run* (x) (scm?->ck number? x));=> '(_.0)

;;;; allowedo not work on racket 
;;    (test-check "8"
;;      (run* (q) (allowedo symbol? q))
;;      `((_.0 : (allowed (,symbol? _.0))))))


detail

(define (scm?->ck f? . xs)
  (goal-construct (scm?->ck-c f? xs)))

(define (scm?->ck-c f? xs)
    (lambdam@ 
     (a : s c )
     (let loop-xs ((x (car xs)) (xr (cdr xs)) (xo '() ))       
	   (let ((x (walk x s))) ;;may be walk* ?
	     (cond	     
	      [(any/var? x) a]
	      [(null? xr)(if (apply f? (reverse (cons x xo))) a #f)]
	      (else
	       (loop-xs (car xr) (cdr xr) (cons x xo))))))))

dbug print using scm?->ck

(define (debug-print x) (display x)(newline) #t)
(define (debug-print-ck  x) (scm?->ck debug-print x)) 

(run* (q)
      (== q 3)
      (debug-print-ck  q)
);;
;;=> 
;;debug print 3 
;;'(3)