Ralf Hemmecke wrote:
>
> On 11/12/2008 11:42 AM, Fabio S. wrote:
> >
> > I can't understand why I am not able to assign an element in a list of
> > lists like in
> >
> > --------
> > (35) -> A:=[[0,0,0,0]]
> > (35) [[0,0,0,0]] Type: List List NonNegativeInteger
> >
> > (36) -> A(1,1)
> > (36) 0 Type: NonNegativeInteger
> >
> > (37) -> A(1,1):=1
> >
> > The form on the left hand side of an assignment must be a single
> > variable, a Tuple of variables or a reference to an entry in an object
> > supporting the setelt operation.
> > --------
>
> I have not looked into the actual sources, but I'd guess, that there is
> no function of the form
>
> setelt: (%,Integer,Integer,R) -> R
> -- will become setelt_!
> ++ setelt(m,i,j,r) sets the element in the ith row and jth
> ++ column of m to r
> ++ error check to determine if indices are in proper ranges
>
> (which you find in array2.spad (TwoDimensionalArrayCategory)) in exports
> of List.
> The above explains, why it works for matrices, since there
>
> setelt: (%,Integer,Integer,R) -> R
>
> is defined.
>
This is only partial answer. I would say that for list of
lists the following should work (and modulo dot/parenthesis
mess is an official syntax):
A(1)(1)
A(1)(1) := 1
The first works, fact that the second does not work is a bug.
I did not look why using A(1, 1) to read list of lists works
(one possibility is that intepreter coerced A to a matrix),
but _if_ this way is intended to work, then lack of setelt
is a bug. However, I would rather think that using A(1, 1)
to read elements of list of lists is something between
bug and quirk and I would discourage its use.
--
Waldek Hebisch
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---