[eclipse-clp-users] Assignment of a value to an element of an array

From: Sergii Dymchenko <kit1980_at_...6...>
Date: Thu, 2 May 2013 21:44:04 -0700
Hello,

I want to assign some value to an element of an array.

This doesn't work:
$: dim(A, [2]), A[1] is 7.
No (0.00s cpu)

But this surprisingly works:
$: dim(A, [2]), 7 is A[1].
A = [](7, _356)
Yes (0.00s cpu)

Also this of course works, but it's a bit inelegant:
$: dim(A, [2]), subscript(A, [1], 7).
A = [](7, _319)
Yes (0.00s cpu)

And this works, but requires ic:
$: dim(A, [2]), A[1] #= 7.
A = [](7, _514)
Yes (0.00s cpu)

Maybe there are some complicated reasons why working syntax is "7 is A[1]"
and not "A[1] is 7"? Maybe it's not too hard to make "A[1] is 7" work in
future ECLiPSe releases?

Sergii.
Received on Fri May 03 2013 - 04:44:11 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET