Hi Waldek,

I cannot send the whole code, but I'd like to ask whether the construction (see RED) should in principle be possible.

It basically says that instead of a package in the argument list of a constructor, I pass a function that returns a package, because I would like to instantiate that package either with (C,L,QXAB) or with (C,F,AB).

The compiler throws a strange error message at me that I cannot interpret.

Any hints?

Thank you in advance.

Ralf

PS: I can certainly rewrite my code if the above passing of a package constructor isn't (yet) working. I'm just curious how good the SPAD compiler already is.

================================================================

QEtaExtendedAlgebraBasis(L, F, AB): Exports == Implementation where
  L: Type
  F: with first: % -> L
  AB: QEtaAlgebraBasisCategory F
  Exports ==> QEtaAlgebraBasisCategory(L) with
    coerce: AB -> %
  Implementation ==> ...

QEtaExtendedReduction(L, F, AB, RED): Exports == Implementation where
  L: Type
  F: with (first: % -> L)
  AB: QEtaAlgebraBasisCategory F
RED: (C:Type, LF:Type, XAB:Type) -> QEtaComputationReductionCategory(LF, XAB)
  QXAB ==> QEtaExtendedAlgebraBasis(L, F, AB)
  Exports ==> with (reduce: (F, AB))
  Implementation ==> add
    reduce(u: F, ab: AB): F ==
        ul: L := reduce(first u, ab :: QXAB)$RED(C, L, QXAB)
        zero? ul => return 0$F
        return reduce(u, ab) $ RED(C, F, AB)

----------------------------------------------------------------------

   initializing NRLIB QETAXRED for QEtaExtendedReduction
   compiling into NRLIB QETAXRED
   compiling local reduce : (F,AB) -> F
****** comp fails at level 4 with expression: ******
error in function reduce

(SEQ
 (|:=| (|:| |ul| L)
  ((|Sel| (RED C L (|QEtaExtendedAlgebraBasis| L F AB)) |reduce|) | << |
   (|first| |u|) | >> | (|::| |ab| (|QEtaExtendedAlgebraBasis| L F AB))))
 (|:=| (|:| #1=#:G52032 (|Boolean|)) (|zero?| |ul|))
 (|exit| 1
  (IF #1#
      (|return| (|Sel| F 0))
      (|return| ((|Sel| (RED C F AB) |reduce|) |u| |ab|)))))
****** level 4  ******
$x:= (first u)
$m:= LF
$f:=
((((|ul| #) (|ab| # #) (|u| # #) (|reduce| # #) ...)))

   >> Apparent user error:
   Cannot coerce ab
      of mode AB
      to mode (QEtaExtendedAlgebraBasis L F AB)

--
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 on the web visit 
https://groups.google.com/d/msgid/fricas-devel/2a3cb28b-1c52-5ec6-53e7-da98defcfb1b%40hemmecke.org.

Reply via email to