Re: [eclipse-clp-users] java - eclipse problem

From: Joachim Schimpf <joachim.schimpf_at_infotech.monash.edu.au>
Date: Wed, 21 Apr 2010 12:50:09 +1000
carole dawood wrote:
> This is how my rpc is made :
> 
> CompoundTerm result= eclipse.rpc(
> 
> "X="+appendedList+",solve(X,Y,W,Z,32)."); and about the outputs , they
> are 3 (Y,W,Z) . I can not read them and when printing the result i get
> this:
> 
> result is com.parctechnologies.eclipse.CompoundTermImpl with [functor=,
> arity=2 arg(1)=com.parctechnologies.eclipse.CompoundTermImpl with
> [functor== arity=2 arg(1)=[com.parctechnologies.eclipse.CompoundTermImpl
> with [functor=item arity=8 arg(1)=1 arg(2)=4 arg(3)=3.0 arg(4)=null
> arg(5)=null arg(6)=null arg(7)=null arg(8)=null]]
> arg(2)=[com.parctechnologies.eclipse.CompoundTermImpl with [functor=item
> arity=8 arg(1)=1 arg(2)=4 arg(3)=3.0 arg(4)=null arg(5)=null arg(6)=null
> arg(7)=null arg(8)=null]]]
> arg(2)=com.parctechnologies.eclipse.CompoundTermImpl with [functor=solve
> arity=5 arg(1)=[com.parctechnologies.eclipse.CompoundTermImpl with
> [functor=item arity=8 arg(1)=1 arg(2)=4 arg(3)=3.0 arg(4)=null
> arg(5)=null arg(6)=null arg(7)=null arg(8)=null]] arg(2)=[] arg(3)=[]
> arg(4)=[] arg(5)=32]]
> 

I have formatted and annotated this for you:

// first we have a ','/2 structure
result is com.parctechnologies.eclipse.CompoundTermImpl with [functor=, arity=2
    // this is a (=)/2 structure
    arg(1)=com.parctechnologies.eclipse.CompoundTermImpl with [functor== arity=2
        arg(1)=[     // Java collection, corresponding to ECLiPSe list
            // and this is an item/8 structure
            com.parctechnologies.eclipse.CompoundTermImpl with [functor=item arity=8
                arg(1)=1 arg(2)=4 arg(3)=3.0 arg(4)=null
                arg(5)=null arg(6)=null arg(7)=null arg(8)=null
            ]
        ]
        arg(2)=[     // Java collection, corresponding to ECLiPSe list
             com.parctechnologies.eclipse.CompoundTermImpl with [functor=item arity=8
                arg(1)=1 arg(2)=4 arg(3)=3.0 arg(4)=null
                arg(5)=null arg(6)=null arg(7)=null arg(8)=null
            ]
        ]
    ]
    // this is solve/5
    arg(2)=com.parctechnologies.eclipse.CompoundTermImpl with [functor=solve arity=5
        arg(1)=[     // Java collection, corresponding to ECLiPSe list
            com.parctechnologies.eclipse.CompoundTermImpl with [functor=item arity=8
                arg(1)=1 arg(2)=4 arg(3)=3.0 arg(4)=null
                arg(5)=null arg(6)=null arg(7)=null arg(8)=null
            ]
        ]
        arg(2)=[]
        arg(3)=[]
        arg(4)=[]
        arg(5)=32
    ]
]

If you take some time to look at this, understand the structure of Prolog terms,
and how they are mapped to Java objects, you should be able to solve your problem.


-- Joachim
Received on Wed Apr 21 2010 - 02:48:32 CEST

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