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, KishReceived on Tue Jan 30 2007 - 23:40:25 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST