Re: [eclipse-users] Newbie: dim in .ecl script

From: Kish Shen <kish.shen_at_...2...>
Date: Tue, 30 Jan 2007 23:41:56 +0000
On Tuesday 30 January 2007 21:09, Philippe de Rochambeau wrote:
> Hello,
> 
> I have a file called testdim.ecl which contains the following line of  
> code:
> 
> dim(M,[3,3]).
> 
> Whenever I type [testdim] in TkEclipse I get the following message
> 
> *** trying to redefine a built-in predicate: dim / 2
> 	before line 2 in the file //C/DOCUMENTS AND SETTINGS/PDER/DESKTOP/ 
> testdim.ecl
> testdim.ecl compiled traceable 0 bytes in 0.00 seconds
> 
> 
> 
> Why can you type dim(M,[3,3]). in tkeclipse and not load a file into  
> tkeclipse containing dim(M,[3,3])?
> 
I assume you mean typing dim(M,[3,3]) into the query entry window of TkECLiPSe. In 
this case, you are typing in a query, whereas in a file, 

dim(M,[3,3]) 

defines a clause for dim/2, which is a built-in (i.e. a predicate pre-defined for ECLiPSe), so you
cannot redefine it, as indicated by the error message.

If you want to indicate a query in your file, you need to prefix it with :-, i.e.

:- dim(M,[3,3]).

The query entry window can only accept queries, hence there is no need to type in the ':-'.

This behaviour is common to Prolog systems, and is probably better explained in many Prolog
textbooks than I am doing here....

Cheers,

Kish
Received on Tue Jan 30 2007 - 23:40:25 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST