Re: Assigning to Element of Array of Records Doesn't Seem to Work

Martin Rubey <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.user
Message-ID <[email protected]>
Bill Wood <[email protected]> writes:

> I'm just trying to assign to a field of a record in a one-dimensional
> array of records, but I get this incomprehensible message:


>    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.

ys(2) is not a single variable, nor a Tuple of variables, but I guess it should
go through as a reference to an entry in an object supporting setelt.  Well,
currently it does not. Thus,

> What do I have to do to set the fields of the records to desired
> values???

use a temporary variable:

(4) -> el := ys(2)

   (4)  [k= 0,rad= 0]
                                        Type: Record(k: Integer,rad: Integer)
(5) -> el.k := 10

   (5)  10
                                                        Type: PositiveInteger
(6) -> ys

   (6)  [[k= 0,rad= 0],[k= 10,rad= 0],[k= 0,rad= 0]]
                    Type: OneDimensionalArray Record(k: Integer,rad: Integer)

Martin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.