I make a list : fricas L := map (t +-> [t,
Type: List(List(Any))I can't extract the second term : - fricas
select (t +-> t.1=2, L) - empty
(2) **Type:**List(List(Any))
I get an error : fricas select (t +-> (t.2).remainder = 1, It seems right : fricas Lc := reduce (append,
Type: List(Any)fricas c := Lc.4
Type: Record(quotient: Integer,But I can't get the quotient : fricas c.quotient divide is right : fricas c2 := divide (20,
Type: Record(quotient: Integer,fricas c2.quotient
Type: NonNegativeInteger?And all theses commands are right : fricas Lb := map (t +-> [t,
Type: List(List(Integer))fricas select (t +-> t.1=2,
Type: List(List(Integer))fricas select (t +-> t.2 = 1,
Type: List(List(Integer))fricas reduce (append,
Type: List(Integer)fricas L := map (t +-> [t,
Type: List(List(Any))is List List Any. So the interpreter seems to be smart to convert this back fricas K := first rest first L
Type: Record(quotient: Integer,to Record(quotient: Integer,remainder: Integer). But it only looks like that. fricas K.remainder gives an error. WHY? A workaround is the following: fricas R := Record(quotient: Integer,
Type: Typefricas H := K :: R
Type: Record(quotient: Integer,fricas H.remainder
Type: PositiveInteger?Ralf The internal types of these objects are of type Any but the interpreter uses the original types when it prints theses objects. See any.spad.pamphlet for information.fricas L := map (t +-> [t,
Type: List(List(Any))fricas Lc := reduce (append,
Type: List(Any)fricas c := Lc.4
Type: Record(quotient: Integer,fricas c
Type: Record(quotient: Integer,fricas )display type c
Type: OutputForm?fricas select(x+->x.1::Integer=2,
Type: List(List(Any))But I think the 2nd problem requiring the coercion to Record of something that is already apparently of that type is a bug. fricas L := map (t +-> makeRecord(t,
Type: List(Record(part1: Integer,fricas select (t +-> t.part1=2,
Type: List(Record(part1: Integer,fricas select (t +-> (t.part2).remainder = 1,
Type: List(Record(part1: Integer,fricas L.2.part2.quotient
Type: NonNegativeInteger?fricas a:= [[x,
Type: List(Any)fricas b:=a.1
Type: List(Polynomial(Integer))fricas )di type b
Type: Polynomial(Integer)fricas c:=a.3
Type: Record(quotient: Integer,fricas )di type cStatus: closed => open This command disables the display of the underlying type of an object of type `Any` .
fricas )set message any With this option fricas ans := [2,
Type: List(Any)then it is clear that the type over which the list is formed have to be made equal.
So we get fricas [1,
Type: List(Any)as fricas makeRecord(1,
Anyway, the question is also why someone wants to have fricas L := map (t +-> [t, Type: List(List(Any))in the first place. Wouldn't be fricas LL := map (t +-> divide (10*t,
Type: List(Record(quotient: Integer,be sufficient? The argument is implicitly given through the list structure. And why not even just compute the following? fricas L3 := map (t +-> divide (10*t,
Type: List(Integer)And as for fricas position (t +-> t.remainder=1,
Type: PositiveInteger?But (I believe) it's nearer the mathematical way to write select (t +-> t.2.remainder=1, map (t +-> , expand (1..20))) So I find all the solutions, and I remain the initial value which is right. It's as . Hier P(t)=t.2.remainder=1 Axiom believes that List are (almost) only in , With other CAS I use list as cartesian product of sets. It's very usefull and pretty to read. With axiom I must use Record. If I use List I must explain that type I read (Record...) isn't type I have (Any...). It's to complex ! With record the length is fixed, and use of Record... is less pretty than use of List... So I prefer that axiom-interpreter translates without question Any type to his own type. Even if there are difficults aroud this map : The first t is a Polynomial or an Integer ? fricas map (t +-> [t,
Type: List(List(Fraction(Polynomial(Integer))))FMy? Don't you think that in it depends on what your E is?If you think that E is the set then something like fricas )clear all
Type: List(Record(quotient: Integer,looks quite mathematical, n'est pas? Well, there is a local assignment to , but it's short enough. If you like your way more than perhaps write fricas K := [divide(10*t, Type: List(Record(quotient: Integer,fricas [t for t in K | t.remainder=1]
Type: List(Record(quotient: Integer,And, by the way, if it weren't for the fact that divide in Aldor's libalgebra library has signature: divide: (%, %) -> (%, %); instead of Axiom's: divide: (%,%) -> Record(quotient:%,remainder:%) The above construction would also work in Aldor.
(The use of Ralf FMy?,I think you meant to write: fricas select(t+->t.remainder=1,
Type: List(Record(quotient: Integer,There is no meaning for I disagree that one should use a list as cartesian product of sets. This is very much against the strong-type design of Axiom. Instead Axom should provide a type equivalent to the cartesian product and it should be (nearly) as flexible as Lists. The next best thing that Axiom has is Record. When creating an anonymous function you can provide specific types: fricas L:=map ((t:INT):Record(t:INT,
Type: List(Record(t: Integer,so that the result is clear. The discussion of Lists, Tuples, Products and Records in Axiom is an old one. See: - http://axiom-wiki.newsynthesis.org/TuplesProductsAndRecords
- http://axiom-wiki.newsynthesis.org/SandBoxDirectProduct
- http://axiom-wiki.newsynthesis.org/187TroubleWithTuples
- http://axiom-wiki.newsynthesis.org/CartesianProduct
I agree that Axiom does not get this right. In Aldor the
I do not know yet how to understand the domain http://en.wikipedia.org/wiki/Duck_typing This a form of dynamic typing where the values from the
domain `showTypeInOutput` can be used to show the underlying type
of an object of type Any.
fricas )set message any off
Type: StringTest fricas a:Any:=[1,
Type: Anyfricas a.1
Type: Anyfricas (a.1)::Integer
Type: Integerfricas (a.2)::String
Type: String |

Any?--Ralf Hemmecke, Mon, 20 Mar 2006 07:45:08 -0600 reply