Hi Francois, if you work in the interpreter, it is probably reasonable to use some Record construction. However, if you do serious programming, then you should consider Record as being a very low level data structure. That is, you are certainly better off in defining a new type instead of just using Record.
For example, suppose, Complex were not yet defined. If you decide to do some computations with complex numbers, it is much better to first think about a reasonable domain that provides all the operations you want, i.e. *you* should define Complex. Clearly, one could do all the computations with Record(re: R, im: R), but would you see at a glance from that record definition that you rely on the usual ring axioms while computing with complex numbers? Sure, defining a new domain is always a burden and it would be better if it had already been done by somebody else, but the Axiom Library is never complete and there will always be cases where a new domain must be defined. I am strongly against using Record at a user interface level. Record should be used inside the library, but always wrapped so that a user sees a "mathematical" domain instead of just such a thumb (record) data structure. Ralf On 02/26/2008 07:06 PM, Francois Maltey wrote: > Dear Ralf and all, > >> In particular [List and] Record provide such bracket function of type [...] >> which allows the usual list construction. >> >> (in Record(a: Integer, b: String, c: Float)) >> bracket: (Integer, String, Float) -> % >> which allows >> >> Arec: Record(a:Integer, b:String, c:Float) := [123,"azerty",1.2e-3] >> >> What else would you want? > > Indeed, the bug is in my mind... Let me explain : > > In my mind theses two cases aren't equivalent : > > // 1 // List is very easy. > > I only type L := [1,2,3] without type > and I play with L.1, L.2... > > // 2 // Record is too subtle. > > Not only because I use less Record than List > but because // A // I must declare this type > and // B // I must choose the field name. (It's too complex for me) > > So semantics of Record and List seems too different, > and my mind prefer to code without Record. > > Alasdair write to axiom-mail in "a simle question" (date : 2.2.2008) > >> Sorry about this; I'm a bit out of practice: >> >> for n in 10..30 repeat output [n, factor(2^n-1)] >> >> This gives the first n in factored form which I don't want. >> How can I obtain the first n in unfactored form? > > The misunderstanding seems the same : use a list instead of record. > > for n in 10..30 > repeat output [n, factor(2^n-1)[EMAIL PROTECTED](a:Integer,b:Factored > Integer) > > And spad/axiom isn't so clear. > I can't get the result I want with my old axiom ! > > So I wait for a automatic translation from/to record in order to simplify > the code I type. > > I have no idea if the operator [...] must be the same or different. > > Have a nice day ! > > Francois ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ open-axiom-devel mailing list open-axiom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open-axiom-devel