Pengine ask and success template

Anne Ogborn <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
I'm afraid your simple example is a tad too simple.


Not entirely clear how I'm to transfer more than one piece of data.

From the simple.html example, lets get the cartesian product of solutions to p and
a new predicate r. Obviously in a real situation we're more likely to want somethign that
has some correlation between the two, but this will suffice



        <script type="text/x-prolog">

   q(X,Y) :- p(X),r(Y).

   p(a).
   p(b).
   p(c).
   p(d).
   p(e).
   p(f).
   p(g).
   
   r(zip).
   r(mort).

        </script>
        <script>
            var pengine = new Pengine({
                oncreate: handleCreate,
                onsuccess: handleSuccess,
 onerror: handleSuccess 
            });
            function handleCreate () {
                pengine.ask("q(X,_)", {     // <--  How can I get Y?
                    template:'X'      // Whats this things format?
                });
            }
            function handleSuccess() {
                $('#out').html(this.data);
            }
        </script>
    </head>
    <body>
        <div>?- q(X,Y).</div>
        <div id="out"></div>

        <button onclick="pengine.next()">Next</button>
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.