Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.independent

Topic: Close Bracket after Rule Identifier!
Replies: 3   Last Post: May 29, 2013 10:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Graham Cooper

Posts: 4,280
Registered: 5/20/10
Re: Close Bracket after Rule Identifier!
Posted: May 27, 2013 12:50 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


> [X]     1        % Welcome To Block Prolog
> [X]     2        % Online In June
> [X]     3        % testing in progress
> [X]     4        %
> [X]     5        test1 a
> [X]     6        test1 b
> [X]     7        test2 A
> [X]     8        test3 [ sub a b c ]
> [X]     9        nat 0
> [X]     10       nat [ s N ] :-
>                      nat N
>




Here is the TABLE HEADS representing the above 'Program'!


id ref term var
1 1 %
1 2 * Welcome
1 3 * To
1 4 * Block
1 5 * Prolog
2 1 %
2 2 * Online
2 3 * In
2 4 * June
3 1 %
3 2 testing
3 3 in
3 4 progress
4 1 %
6 1 test1
6 2 a
7 1 test1
7 2 b
8 1 test2
8 2 * A
9 1 test3
9 21 sub
9 22 a
9 23 b
9 24 c
10 1 nat
10 2 0
11 1 nat
11 21 s
11 22 * N



THE TAILS TABLE


id ref term var tail
11 1 nat 1
11 2 * N 1


THE QUERY TABLE


ref term buds
1 nat 0
2 0 0

...


it got half way through nat [s 0] ?

found nat [s X[
grabbed the tail nat X
bound nat 0

and is about to Unify nat 0... but got stuck...


Check it out!
http://www.PHPProlog.com

One more overhaul and should get it working this week!


This is the PROLOG ENGINE in 1 SQL statement (per match)

$sql="SELECT HEADS.id AS 'HID', QUERY.buds AS 'QB'
FROM QUERY
INNER JOIN HEADS
ON QUERY.ref=HEADS.ref
AND QUERY.term=HEADS.term
GROUP BY HID
HAVING COUNT(HID)=$qc-SUM(QB)";

This supersedes recursive descent Engines from 1972.

Herc




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.