Re: [eclipse-clp-users] ic:element/3 for float values

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Tue, 09 Jul 2013 14:02:34 +0100
On 08/07/2013 19:47, Sergii Dymchenko wrote:
> Hi,
>
> I can use ic:element/3 like this:
>
> [eclipse]: X #>= 2, A = [](10, 20, 30), element(X, A, Z).
> X = X{[2, 3]}
> A = [](10, 20, 30)
> Z = Z{[20, 30]}
>
> But if A contains float values, I get "type error in Z".
>
> I've looked at the source code of element/3 and found that it does some complicated stuff that
> makes sense only if values are integers.
> Any suggestions how to make ic:element/3 work with float values (maybe in some surrogate form)?


Using lib(ic) and lib(propia):

?- member(I - F, [1 - 11.1, 2 - 22.2, 3 - 33.3]) infers ic.
I = I{1 .. 3}
F = F{11.1 .. 33.3}
There is 1 delayed goal.
Yes (0.00s cpu)

?- member(I - F, [1 - 11.1, 2 - 22.2, 3 - 33.3]) infers ic, I #> 1.
I = I{[2, 3]}
F = F{22.2 .. 33.3}
There is 1 delayed goal.
Yes (0.00s cpu)

?- member(I - F, [1 - 11.1, 2 - 22.2, 3 - 33.3]) infers ic, F $>= 20.
I = I{[2, 3]}
F = F{22.2 .. 33.3}
There is 1 delayed goal.
Yes (0.00s cpu)


Cheers,
Joachim
Received on Tue Jul 09 2013 - 13:02:44 CEST

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