Error Message 
Author Message
 Error Message

Can anyone explain this?

{DOMAIN ERROR: _57 is 9+calc_route_cost([[3,3],[5,7],[9,9]],_52) - arg 2:
expected expression, found calc_route_cost([[3,3],[5,7],[9,9]],_52)}
{trace}

from this code;

calc_cost([X1|Y1],[X1|Y1],0).
calc_cost([X1|Y1],[X2|Y2],Ans) :-
 Ans is 1 + (X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1).

calc_route_cost([],0).

calc_route_cost([H|T],Ans):-
 length([H|T],2),
 flatten(T,T2),
 calc_cost(H,T2,Ans).

calc_route_cost([H1,H2|T],Ans) :-
 calc_cost(H1,H2,Sub_ans),
 Ans is Sub_ans + calc_route_cost([H2|T],Z).

thanks

geoff



Fri, 09 May 2003 03:00:00 GMT  
 Error Message

Quote:

> Can anyone explain this?

> {DOMAIN ERROR: _57 is 9+calc_route_cost([[3,3],[5,7],[9,9]],_52) - arg 2:
> expected expression, found calc_route_cost([[3,3],[5,7],[9,9]],_52)}
> {trace}

It says it (arg2) is not a number nor a evaluable expression (see at bottom).

Quote:
> from this code;

> calc_cost([X1|Y1],[X1|Y1],0).
> calc_cost([X1|Y1],[X2|Y2],Ans) :-
>  Ans is 1 + (X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1).

> calc_route_cost([],0).

> calc_route_cost([H|T],Ans):-
>  length([H|T],2),
>  flatten(T,T2),
>  calc_cost(H,T2,Ans).

> calc_route_cost([H1,H2|T],Ans) :-
>  calc_cost(H1,H2,Sub_ans),
>  Ans is Sub_ans + calc_route_cost([H2|T],Z).

As prolog is not a functionnal language, you must rewrite the
previous rule to this:

calc_route_cost([H1,H2|T],Ans) :-
  calc_cost(H1,H2,Sub_ans),
  calc_route_cost([H2|T],Z)
  Ans is Sub_ans + Z.

HTH
--
Pascal



Fri, 09 May 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ERROR MESSAGE: Internal Error: tpsbt.cpp line 2172

2. Network error Message Error 50

3. Error message dbcommital internal error 19

4. Error message Ordlistadd (0) Internal error 1010

5. Error message Internal error 1010

6. spelling error in [scan] error message :)

7. Unexpected error message of the Dolphin licencing system

8. Error Message Questionnaire

9. Odd (non) error message when clicking on inherited method names

10. Missing OCX error messages

11. BUG: PositionableStream<<position: (wrong error message)

12. Error message

 

 
Powered by phpBB® Forum Software