Re: Problem regarding soft cut(*->).

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Thu 02 Jan 2003 04:13:16 PM GMT
Message-ID: <3E14651C.5E9F3A94@icparc.ic.ac.uk>
Jinyi wrote:
> 
> Hi All,
> 
>        recently, I got some problem with soft cut(*->).
> 
>        I'm working with Eclipse release 5.4 under Windows 2000( also tried
>        with Eclipse 5.4 + Solaris 5.7).
> 
>        Have the program follows compiled:
>        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>        :-lib(fd).
>        :-op(1050, xfx, *->).
>        :-import (*->)/2 from sepia_kernel,
>        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> 
>        [eclipse 8]: member(X,[1,3]) *-> Y #= X+1; Y #=0.
>        calling an undefined procedure sepia_kernel : (member(X, [1, 3]) *->
> Y #= X+1) in module eclipse
>        Abort
> 
>        Any hints about the above error message?

This is a bit of an anomaly in Eclipse: it will only work when
the *-> occurs in compiled code. I.e. if you compile a clause like

p(X,Y) :- ( member(X,[1,3]) *-> Y #= X+1; Y #=0 ).

you will be able to call p(X,Y).


> 
>        In case the soft cut is obsolete (however still documented in release
> 5.4's manual),
>        are there any alternatives?

See the reference manual entry for shelf_create/2. It contains
and example definition for if/3 which does a similar thing.


> 
>        Thanks a lot in advance!!
> 
> Cheers,
> Jinyi

A more general point is: what do you want to achieve here?
The meaning of
    member(X,[1,3]) *-> Y #= X+1 ; Y #=0
is quite difficult to understand, I doubt that it does what
you want. Why not simply:
    member(X,[1,3]), Y #= X+1 ; Y #=0


-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Thu Jan 02 16:13:55 2003

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