axiom-developer
[Top][All Lists]

## Re: [Axiom-developer] Re: [Aldor-l] RE: Axiom domains and Aldorreturnty

 From: William Sit Subject: Re: [Axiom-developer] Re: [Aldor-l] RE: Axiom domains and Aldorreturntypes Date: Thu, 13 Jan 2005 02:56:25 -0500

```William Sit wrote:

> --%PointedPrimeField
> )abbrev domain PPF PointedPrimeField
> PointedPrimeField(n:PositiveInteger):Cat==Dog where
>   Cat == FiniteFieldCategory with
>     foo:PositiveInteger->PrimeField(n)
>     foo(k)==k::Integer::PrimeField(n)
>
> After compiling, define in the interpreter
>
> g(n,k)==foo(k)\$PPF(n)
>
> and it works (in Axiom)! (Do not declare the types for g because n is not
> defined).

I meant in the interpreter. Compiling g is still a problem in Axiom due to
signature limitation. At least this way, inlining a complicated function is
almost like a function call.

The idea is: Since in creating domains, we are in effect creating a function(the
domain constructor PPF is a function of sort, or functor) and the compiler can
take dependent types in its signature, structurally:
PPF(n:PositiveInteger)==PrimeField(n) with foo
so it should be able to compile something like g by lifting it to the package
level.

So here is another way using package.

--%Foo
)abbrev package FOO Foo
Foo(n:PositiveInteger, k:PositiveInteger):T==C where
T == with
point:()->PrimeField(n)
point()==k::Integer::PrimeField(n)

After compiling, we can use

point()\$Foo(n,k)

in any computation in compiler code (and in interpreter). Still can't call this
g(n,k) unless you use a macro expansion:

g(n,k)==>point()\$Foo(n,k)

William
--
William Sit