Code: Select all

```
%Previous
Distance = calculateDistance([34.045,45.453],[89.34,23.56]).
RootValue = squareroot_calcualtion(-2).
power = powerFunction(Distance,RootValue).
%Now
power = powerFunction(calculateDistance([34.045,45.453],[89.34,23.56]),squareroot_calcualtion(-2)).
```

Can unification be DYNAMIC rather than matching constants.

Code: Select all

```
%normally
constants
pFUNCTION = 100.
pPROCEDURE = 200.
pRPAREN = 300.
pLPAREN = 400.
pCOMMA = 500.
pDIGITS = 600.
pIDENTIFIER = 700.
pMINUS = 800.
pPLUS = 900.
...
predicates
parse:(integer,integer,integer,integer,....) multi (i,i,i,i,...).
clauses
parse(pFUNCTION,pLPAREN,pDIGITS,pRPAREN):-
stdio:write("You have found a FUNCTION\n").
parse(pPROCEDURE,pLPAREN,pDIGITS,pRPAREN):-
stdio:write("You have found a PROCEDURE\n").
% Is this possible
constants
pFUNCTION = 100.
pPROCEDURE = 200.
pRPAREN = 300.
pLPAREN = 400.
pCOMMA = 500.
pDIGITS = 600.
pIDENTIFIER = 700.
pMINUS = 800.
pPLUS = 900.
...
class facts
dynfact01:(integer) single.
dynfact02:(integer) single.
dynfact03:(integer) single.
dynfact04:(integer) single.
dynfact05:(integer) single.
....
clauses
dynfact01(pFUNCTION).
dynfact02(pLPAREN).
dynfact03(pDIGITS).
dynfact04(pRPAREN).
....
predicates
parse:(integer,integer,integer,integer,....) multi (i,i,i,i,...).
return_token1: () -> integer procedure.
return_token2: () -> integer procedure.
return_token3: () -> integer procedure.
return_token4: () -> integer procedure.
return_token5: () -> integer procedure.
...
clauses
return_token1() = pPROCEDURE.
return_token2() = pLPAREN.
return_token3() = pDIGITS.
return_token4() = pRPAREN.
clauses
% using facts that can be changed
parse(dynfact01(T1),dynfact01(T2),dynfact01(T3),dynfact01(T4)):-
stdio:write("You have found a FUNCTION\n").
% using functions that their return value could change
parse(return_token1(),return_token2(),return_token3(),return_token4()):-
stdio:write("You have found a PROCEDURE\n").
```

Thanks.