In the process of writing some Spad packages, I realized that I need to generalize one of them by introducing another package parameter, because one of the types would need to be determined by the caller.
Source file: https://gitlab.com/nsajko/fricas_guessing/-/blob/master/guessing_helpers.spad The package is GuessingHelpers, and the problematic parameter is "In". Before I tried to turn it into a parameter, it was simply defined as Fraction Integer, however I want to generalize the package so that In can be either a Fraction Integer or a Fraction Polynomial Integer. For a start, I declared In like this: In: Join(Field, CoercibleFrom Integer, CoercibleFrom Fraction Integer) However, this predictably fails, as my package requires In to be coercible to Expression Integer. If I declare In like this: In: Join(Field, CoercibleFrom Integer, CoercibleFrom Fraction Integer, CoercibleTo Expression Integer) Then I can't construct the package because Fraction Integer doesn't have the CoercibleTo Expression Integer category. How should I declare In? Is it possible to declare a package parameter so as to enumerate a set of types, and saying that the parameter has to be a member of that set? This would work for me, I could simply declare In as "either Fraction Integer or Fraction Polynomial Integer". Thanks, Neven -- 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/CAL%2BbK4OKkQ%2BqGBP2mXQfpDt9hu7_Emj2t_-Aog0Zy%2BRamd1B6g%40mail.gmail.com.
