Date: Jun 22, 2013 1:31 AM
Author: INFINITY POWER
Subject: NAT ( S(X) )  ??

http://phpprolog.com/so-frikin-complicated.png  !!!

f*KN MONTHS debugging this!

Never program your own 5GL!

nat(s(s(s0))) was working months ago!


---------------------------


nat [ s [ s X ]]?

PUSH: 0 .... V X .... REF :222 .... TERM | 0..0

LEFT: 10 - - nat - 1 - nat ...
LEFT: 10 - - s - 21 - s ...
LEFT: 10 - N - * - 22 - ...

GV:1
NUM HEAD VARS:1
VARSTACK: N:22

RIGHT: 10 - - nat - 1 - nat ...
RIGHT: 10 - - s - 21 - s ...
RIGHT: 10 - - - 221 - s ...

hvars[m]: N hrefs[m]: 22 QR: 221
PUSH: 1 .... V N .... REF 22:1 .... TERM s | 1..1

TRY 1
nat [ s N ]

TRM: nat TAIL 1
nat N
nat s

LEFT: 10 - - nat - 1 - nat ...
LEFT: 10 - - s - 21 - s ...
LEFT: 10 - N - * - 22 - ...

NUM HEAD VARS:1
VARSTACK: N:22

RIGHT: 10 - - nat - 1 - nat ...
RIGHT: 10 - - s - 21 - s ...

TRY 1
nat [ s N ]

TRM: nat
TRM: N
PUSH: 2 .... V N .... REF :2 .... TERM | 0..0
TAIL 1
nat N
nat N

LEFT: 9 - - nat - 1 - nat ...
LEFT: 9 - - 0 - 2 - ...

nextref:X REF:222 HR: 2

GOAL PUSH: 3 .... V N2 .... REF 2: .... TERM 0 | 3..3

NUM HEAD VARS:0

RIGHT: 9 - - nat - 1 - nat ...

TRY 1
nat 0
MATCH
TRUE 1
MATCH
TRUE 1
MATCH


===================



STACK: 1 - X - :22 -
STACK: 2 - N1 - : - X
STACK: 3 - N1 - :2 - *
STACK: 4 - N1 - 2: - 0

nat [ s X ]?

X = 0

==================


OK.... 9 out of 10 Unify cases working!


Herc
--

www.phpPROLOG.com