On Thu, Jul 03, 2025 at 01:24:35AM +0200, 'Ralf Hemmecke' via FriCAS - computer
algebra system wrote:
> Hello,
>
> Since I have two packages PA and PB with the same parameters and exports
> that behave slightly differently, I would like to be able to pass them to
> another constructor C to use them internally there. So I want the respective
> packages be build/instantiated inside C (and maybe with different
> parameters.
>
> To simplify it a bit I came up with the following construction (attachment).
>
> ================
> )abbrev package RHX RHx
> RHx(R: Ring, POL: R -> UnivariatePolynomialCategory R): with
> var: () -> OutputForm
> == add
> mon ==> monomial $ POL(R)
> var(): OutputForm == mon(1$R,1$NonNegativeInteger) :: OutputForm
> ================
You are exploring land of bugs. The following compiles
)abbrev package RHX RHx
RHx(R: Ring, POL: R -> UnivariatePolynomialCategory R): with
var: () -> OutputForm
== add
fT := POL(R)
mon ==> monomial$fT
var(): OutputForm == mon(1$R, 1$NonNegativeInteger)::OutputForm
but generated code is wrong.
In general, your code here is quite different than current algebra
code. That is normally caller would evaluate POL(R) nad RHx would
use its value.
Also, do I guess correctly that you want to pass
RHSparseUnivariatePolynomial as an argument to RHx? Currently
constructors and functions defined inside constructors use
different call convention. In Spad we can write functions
producing types and functions taking types as arguments, and
normally one should expect POL to be such a function.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/aGXZz0BNCrgOBe-0%40fricas.org.