[racket] %<= doesn't like logic variables bound to numbers?

From: Tom Dean (tld at google.com)
Date: Fri May 16 00:16:46 EDT 2014

(require racklog)

(define (list-index l x)
  (for/or ([y l] [i (in-naturals)] #:when (equal? x y)) i))

(define ALPHAQ '(A B C D E F G H I J K L M N O P Q))

;; Are U and V within N words of each other in S
(define %within-span-relational
  (%rel (u up v vp n s)
[(u v n s)
 (%is up (list-index s u))
 (%is vp (list-index s v))
 (%is #t (<= n (abs (- up vp))))]  ))

;; > (%which () (%within-span-relational 'C 'G 3 ALPHAQ))
;; '()

;; Same as above but using the relation %<= instead of
(define %within-span-procedural
  (%rel (u up v vp n s)
[(u v n s)
 (%is up (list-index s u))
 (%is vp (list-index s v))
 (%<= n (abs (- up vp)))]  ))

;; > (%which () (%within-span-procedural 'C 'G 3 ALPHAQ))
;; > -: contract violation
;;   expected: number?
;;   given: #<logic-var>
;;   argument position: 1st
;;   other arguments...:
;;    #<logic-var>
;;   context...:
;;   /Applications/Racket/collects/racket/private/misc.rkt:87:7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140515/f750d2b1/attachment.html>

Posted on the users mailing list.