Re: Declare variable type within function
Martin Rubey <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <[email protected]> |
"Bill Page" <[email protected]> writes: > > But I can play tricks like this: > > > > foo(x)== > > L:=[x.1-x.1] > > L:= append(L,x) > > return L > > > Although you might still consider it a "trick" I would suggest the > following code that I think is more transparent: > > foo(x)== > L:=select(a+->false,x) > L:= append(L,x) Angelos' trick is better: select would have to consider every element of x... But maybe you like foo(x)== L:= if empty? x then x else rest [first x] L:= append(L,x) The best way to go forward is of course to make type inference better. (And I do believe that it's already quite OK, contrary to Bill) Martin