axiom-mail
[Top][All Lists]
Advanced

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

Re: [Axiom-mail] Declare variable type within function


From: Themos Tsikas
Subject: Re: [Axiom-mail] Declare variable type within function
Date: Mon, 17 Mar 2008 09:35:18 +0000
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

foo(x) == list x

works for you?

Themos Tsikas


On Monday 17 March 2008, Angelos Mantzaflaris wrote:
> Hello,
>
> Here is a newbie question: I am writing some axiom scripts for which I
> don't want to declare I/O types. But, I need to declare, for example, an
> empty list of typeOf(input). I have tried the following:
>
> foo(x)==
>       L:=[]
>       L:= append(L,x)
>       return L
>
> Axiom will complain:
> The type of the local variable L has changed in the computation.
> We will attempt to interpret the code. I also try:
>
> foo(x)==
>       L:=[]::typeOf(x)
>       L:= append(L,x)
>       return L
>
> Axiom will complain again:
> Cannot compile conversion for types involving local variables.
> In particular, could not compile the expression involving :: typeOf
> AXIOM will attempt to step through and interpret the code.
>
> But I can play tricks like this:
>
> foo(x)==
>       L:=[x.1-x.1]
>       L:= append(L,x)
>       return L
>
> And Axiom will compile the function without errors:
> Compiling function foo with type List PositiveInteger List Integer
>
>
> So my question is, how can I do this in a straightforward way (without
> playing tricks)?
>
> Thank you in advance,
> Angelos
>
>
>
>
> _______________________________________________
> Axiom-mail mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/axiom-mail
>
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star.
> ________________________________________________________________________



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________




reply via email to

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