axiom-developer
[Top][All Lists]
Advanced

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

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)
>   Dog == PrimeField(n) add
>     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)
  C == add
       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
Department of Mathematics....Email: address@hidden
City College of New York................Tel: 212-650-5179
Convent Ave at West 138th Street........Fax: 212-862-0004
New York, NY 10031..Axiom, A Scientific Computation Sytem
USA............... http://www.nongnu.org/axiom/index.html




reply via email to

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