axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fricas-devel] Re: [Axiom-mail] A simple question


From: Alasdair McAndrew
Subject: Re: [fricas-devel] Re: [Axiom-mail] A simple question
Date: Sun, 3 Feb 2008 12:58:02 +1100

Since all elements in a list have the same type (unless I request otherwise), maybe I should have written

for n in 10..30 repeat output [n,[factor(2^n-1)]]

I take your point about typing; just that there are occasions when Axiom's typing rules forces the idiot user (i.e., me!) to put more effort into obtaining a result than he wanted!

-Alasdair

On Feb 3, 2008 9:39 AM, root <address@hidden> wrote:

>it is axiom which is at fault, or at least the _expression_ parsing of it.
>Since factor clearly is only applied to the second term in the list, it
>shouldn't be applied to the first.  And I shouldn't have to coerce n to type
>String, Symbol etc to force nonfactoring.

Axiom's type system, like any type system, forces you to understand
what your _expression_ means. In your original case you are asking to
create a list object. Lists have a single type based on their
contents. The full type of the list is List Factored Integer
so all of the elements are of the same type.

Axiom correctly resolved to the lowest common point in the type tower
and this is both the correct and expected behavior.

If you want a List Any immediately you could construct one as in:

m:List Any:=nil
for n in 10..30 repeat output concat(i,concat(j,m))

or, more concisely:

for n in 10..30 repeat output [n::Any, factor(2^n-1)]

Tim





reply via email to

[Prev in Thread] Current Thread [Next in Thread]