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