Re: Arrays and C++ interface

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Fri 20 Aug 2004 12:59:55 PM GMT
Message-ID: <4125F5CB.6060507@icparc.ic.ac.uk>
masdeval wrote:
>     How can i do the code below using eclipse's C++ interface and control structures?

It is not entirely clear what you mean by "do the code", but i suppose that
in the end you want to execute it.


> 
>     Board[1..M, 1..N]   ::  0..1
> 
>     Board[I, 1..N] #= RowSums[I]
> 
>     Supose that M, N,  I, Board, RowSums are EC_word variables and i must use them. 

Rather than wasting your time trying to create such complicated goals from C++,
you create (once) an auxiliary clause like

    method1(X1,X2,X3) :- X1[1..X2, 1..X3] :: 0..1.

(by eclipse-compiling it from a file or string, see compile_stream/1).

Then, whenever you want to execute a goal like

     Board[1..M, 1..N] :: 0..1

you post instead a simple goal like

     method1(Board, M, N)

via the C++ interface.


-- 
  Joachim Schimpf              /             phone: +44 20 7594 8187
  IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
  Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Fri Aug 20 14:02:35 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:30 PM GMT GMT