Re: [open-axiom-help] some questions about list processing
A system for computer algebra and symbolic mathematics
Brought to you by:
dos-reis
From: Gabriel D. R. <gd...@in...> - 2010-04-29 13:24:14
|
On Wed, Apr 28, 2010 at 12:04 AM, Mogei Wang <mog...@gm...> wrote: > Hello,every one > I have a few questions about list processing > > 111111111 How to creat a list of Records? By that, do you mean a list of record values or a list of record types? If you meant a list of record values, you can use the function makeRecord: a := [makeRecord(i,i * i) for i in 1..10] > I have tried in the > following way, but failed: > > (1) -> a:=[Record(x:Integer,y:Float) for i in 1..10] that is creating a list of record *types*. > (1) > [Record(x: Integer,y: Float), Record(x: Integer,y: Float), > Record(x: Integer,y: Float), Record(x: Integer,y: Float), > Record(x: Integer,y: Float), Record(x: Integer,y: Float), > Record(x: Integer,y: Float), Record(x: Integer,y: Float), > Record(x: Integer,y: Float), Record(x: Integer,y: Float)] > Type: List Domain > (2) -> a.1 > > (2) Record(x: Integer,y: Float) > Type: Domain That is correct. > (3) -> a.1.x > There are 1 exposed and 1 unexposed library operations named elt > having 1 argument(s) but none was determined to be applicable. > Use HyperDoc Browse, or issue > )display op elt > to learn more about the available operations. Perhaps > package-calling the operation or using coercions on the arguments > will allow you to apply the operation. > > Cannot find application of object of type Domain to argument(s) of > type(s) > Variable x This is also correct. There is no selection operation named '.x' to perform on the record type a.1. > > (3) -> a.1:=[3,4.5] > > 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. If you want to assign to the first element in the list, use setfirst! In this case, it will not word, because you are trying to store a record value where a record type is expected. |