[Aldor-l] [fricas-devel] Re: Indexed Union
Bill Page
bill.page at newsynthesis.org
Wed Apr 2 18:17:24 EDT 2008
On Wed, Apr 2, 2008 at 11:40 AM, Bill Page wrote:
> ...
> > > Consider the canonical example of a function that takes and a
> > > non-negative Integer 'n' and returns the zero "vector" of type
> > > 'DirectProduct(n,Integer)'
> > >
> > > zeroVector(n:NonNegativeInteger):DirectProduct(n,Integer)
> > >
> > > As far as I know it is impossible to write such a function in any
> > > version of Axiom as it stands today but this is possible in Aldor.
> >
> On Wed, Apr 2, 2008 at 4:38 AM, Ralf Hemmecke wrote:
>
> > I think, no matter whether or not this is possible in Aldor, it looks
> > like a bad construction.
> >
> > Suppose you implement the DirectProduct constructor with only
> > vectors of length n in mind. You would probably want your zero
> > vector to have signature
> >
> > 0: %
> >
> > and not
> >
> > zeroVector: NNI -> %
> >
>
> No 'zeroVector' is not a vector. [0,0,0] is a member of 'zeroVector(3)'.
>
Oops, sorry. Re-reading I see that what I wrote above is nonsense.
What I should have said is that in this example 'zeroVector' is not an
operation exported by DirectProduct.
Of course DirectProduct in Axiom does define 0 that way and one can
certainly write:
0$DirectProduct(3,Integer)
I don't agree that my 'zeroVector' is a "bad construction" although I
have to admit that it is somewhat artificial. The point of the example
is a function whose result type depends on the value of it's
arguments. The situation can be much more complicated than this.
Regards,
Bill Page.
More information about the Aldor-l
mailing list