## #20 Using Hilog problem

open
nobody
None
5
2006-08-30
2006-08-30
hugum
No

Hello all,

I would like to transform a set of predicate by adding
two parameters C1 and C2. For instance instead of call
"pred(a1,a2)." i 'd like to call "pred(a1,a2,C1,C2)."

I have tried to use hilog terms. Here is the code of my
file :
------------------------------------------
:-import append/3 from basics.
:-hilog sup.

exec(Action,C1,C2):-
Action =.. [PredAction|Arg],
append(Arg,[C1,C2],ArgWithC1C2),
sup(PredAction)(ArgWithC1C2).

sup(P)(Arg):-
P(Arg).

action([A,B,A,B]).
-------------------------------------------

When I call "?-exec(action(a,b),C1,C2)." I get
no

I thought that I would get :
C1 = a
C2 = b

Can you please explain me? Is there a better way for
adding 2 parameters to a predicate?

Hugues

PS : Here is the trace.
--------------------------------------------
(0) Call: exec(action(a,b),_h122,_h136) ?
(1) Call: action(a,b) =.. [_h217|_h218] ? s
(1) Exit: action(a,b) =.. [action,a,b] ?
(2) Call: append([a,b],[_h122,_h136],_h278) ? s
(2) Exit:
append([a,b],[_h122,_h136],[a,b,_h122,_h136]) ?
(3) Call: sup(action)([a,b,_h122,_h136]) ?
(4) Call:
apply_testHilog(sup(action),[a,b,_h122,_h136]) ?
(5) Call: action([a,b,_h122,_h136]) ?
(6) Call: apply_testHilog(action,[a,b,_h122,_h136]) ?
(6) Fail: apply_testHilog(action,[a,b,_h122,_h136]) ?
(5) Fail: action([a,b,_h122,_h136]) ?
(4) Fail:
apply_testHilog(sup(action),[a,b,_h122,_h136]) ?
(3) Fail: sup(action)([a,b,_h122,_h136]) ?
(2) Redo:
append([a,b],[_h122,_h136],[a,b,_h122,_h136]) ?
(2) Fail: append([a,b],[_h122,_h136],_h278) ?
(1) Redo: action(a,b) =.. [action,a,b] ?
(1) Fail: action(a,b) =.. [_h217|_h218] ?
(0) Fail: exec(action(a,b),_h122,_h136) ?