Re: [eclipse-clp-users] Reading File

From: Kish Shen <kisshen_at_cisco.com>
Date: Fri, 13 Nov 2009 17:29:00 +0000
Igor Kondrasovas wrote:
> 
> The thing is that the "dim" predicate is exiting unexpectedly and the
> program stops.
>
>  
> 
> I suppose the read_file is not actually returning an array of values that
> dim predicate can use. Looking at the tracer I couldn't reach a conclusion.
> 
>
Your read_file constructs a *list* of values (assuming the data you are 
reading is in the right format). This is not an array. Lists and arrays 
are different data structures.

Your call to dim/2 is probably failing (I assume that is what you mean 
by `exit'), because you are calling it with a list rather than an array.
This has no dimension, so the second argument (the dimension) is set to 
the empty list ([]), which does not unify with your second argument.

If you are unfamiliar with the basic data types of Prolog/ECLiPSe (such 
as the difference between lists and structures), it would be quite 
difficult to program in ECLiPSe, and you probably need to become more 
familiar with programming in Prolog by reading some introductory 
textbook on it. You could also read the tutorial chapter on Prolog, this 
may be a little too concise if you have no background at all with Prolog.

Cheers,

Kish


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Fri Nov 13 2009 - 17:29:16 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET