[racket] Racklog: asking data from user?

From: Mikko Tiihonen (mikko.tiihonen at tmtiihonen.fi)
Date: Thu Apr 12 14:31:41 EDT 2012


I have just started to study Racket and Racklog, so this probably is a very elementary problem, but I haven't been able to find a satisfactory solution on my own, and I would be grateful for getting some pointers into the right direction.

I'm trying to employ Racklog for mixed forward and backward chaining inference and have conducted some experimentation with it. I use a blackboard-like repository for facts implemented as a Racklog predicate. However I have not been able to figure out how I could automatically ask the user for missing pieces of data. When the inference engine tries unsuccessfully to unify a goal with the blackboard, I would like to present the user with a dialog asking her to input the data, which could then be added to the blackboard. Embedding this into Racklog predicates has turned out to be harder than I could imagine - probably I've just overlooked or misunderstood some critical piece of data in the Racklog manual.  Any help will be appreciated.

Best regards,

Mikko Tiihonen


This succeeds, when tried directly:

(define %pred
  (%rel ()
        (() (%== #t (equal? (read-line) "t")))))

but when chained backwards from another predicate, no dialog is presented.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120412/1d0f20dc/attachment.html>

Posted on the users mailing list.