[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: conditionally defined functions
From: |
Martin Rubey |
Subject: |
[Axiom-developer] Re: conditionally defined functions |
Date: |
Fri, 17 Sep 2004 15:14:49 +0000 |
Ralf HEMMECKE writes:
> Hi Martin,
>
> > Suppose you have a category A, taking as parameter a domain P and
> > providing an
> > operation f: % -> P. Furthermore, you have a category (or a domain, a
> > package)
> > B, taking as parameter a domain Q. Now you want to achieve the following:
> >
> > If Q is a domain in A, provide a function g: % -> P, using f.
>
> Let me translate this into some code...
>
> define A(P: Cat1): Category == with {
> f: % -> P;
> }
>
> -- Assume B should be a domain.
> B(Q: Cat2): Cat3 with {
> if Q has A(???) then {g: % -> ???}
> }
>
> To me it seems that in order to state that "Q is a domain in A" one
> would have to know the parameter of A. Note that A is a function
> returning a category. The ??? should be something of type Cat1. And I
> don't see this information somewhere available inside the definition of B.
>
> I guess that is not your point. Can you be more precise here?
Hmm, I think it is my point indeed. I don't know Aldor syntax, but my idea was
roughly
define A(P: Cat1): Category == with {
arg: () -> Cat1
f: % -> P;
-- the operation arg returns a domain...
arg () == P
}
-- Assume B should be a domain.
B(Q: Cat2): Cat3 with {
if Q has arg: () -> Cat1 then {g: % -> arg()}
}
Thanks for replying that fast,
Martin