Ralf Hemmecke <[EMAIL PROTECTED]> writes: > On 06/26/2007 08:07 PM, Stephen Wilson wrote: > > Martin Rubey <[EMAIL PROTECTED]> writes: > >> Dear Stephen, > >> > >> many thanks for your detailed answer. I must admit however, that I dislike > >> your idea writing > >> > >> D(P : Polynomial (R : Ring)) : ... == ... > >> > >> for > >> > >> D(R : Ring, P : Polynomial R) : ... == ... > >> > >> Isn't this just syntactic sugar? My feeling (!) is that this will pose > >> more > >> questions than answers. Enforcing case sensitivity on values, domains and > >> categories also does not look very appealing to me, sorry. > > It may be syntactic sugar for the sake of a function definition, but > > it > > implies a handling of types which diverges from how things are > > currently done. > > I must say, no matter whether it is syntactic sugar or not, a > definition of the form > > (*) D(P : Polynomial (R : Ring)) : ... == ... > > would confuse me. How am I supposed to used that? Should I write
Boy, my first email this morn had a few more typos than I would have liked. Ill try to ensure I have at least one cup of coffee before sitting down to write an email :) In the scheme I was (trying, badly) to suggest would have looked as follows: D(p : Polynomial (R : Ring)) : ... == .. Notice the p is lowercased, hense denoting a domain value. Note that Martins email gave me some understanding into how the advantages of such `patterns' can be expressed in target types using only the notion of tuple. So this really is just syntatic sugar. Im not married to it at all :) > D(P) for some polynomial? (Note that Polynomial is a domain so P is an > element.) > You probably don't mean that. So let's assume that Polynom(R) is a category. > > Now suppose I define > > define MyPolyCat:Category == Polynom(Integer) with ... > MyPoly: MyPolyCat == add ... > > Now can I write > > D MyPoly > > ??? (Note that it doesn't exactly match your pattern (*).) > Or should I rather write > > D(Integer, MyPoly) > > even with just the definition (*)? > > I cannot see that I would like such sugar. Ok, sorry for the confusion. Using your example, I would have written: D(P : Polynom(R : Ring)) ... Then yes, you would write `D MyPoly'. As an involved example, consider the following from libalgebra. We have: macro { DRX == DenseUnivariatePolynomial R; UPC == UnivariatePolynomialAlgebra; UTSC == UnivariateTaylorSeriesType; } UnivariateTaylorSeriesNewtonSolver(R:Join(ArithmeticType, ExpressionType), RXX:UTSC R, RXXY:UPC RXX): with { ... One way you could write such a thing using the scheme I proposed is: macro { DUP(R) == DenseUnivariatePolynomial R; UPC == UnivariatePolynomialAlgebra; UTSC == UnivariateTaylorSeriesType; UTSNS == UnivatiateTaylorSeriesNewtonSolver; } UTSNS(RXXY : UPC(RXX: UTSC(R : Join(ArithmeticType, ExpressionType)))) Thus, a user of the solver would only need to supply a single pice of information, a domain implementing UnivariatePolynomialAlgebra. The arity is reduced from three to one. But it is just syntatic sugar. > > Ralf Thanks again, Steve _______________________________________________ Axiom-developer mailing list Axiom-developer@nongnu.org http://lists.nongnu.org/mailman/listinfo/axiom-developer