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

"Alasdair McAndrew" <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.user
Message-ID <[email protected]>
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 <[email protected]> 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
>
>
>
>

_______________________________________________
Axiom-mail mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-mail
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.