On Tue, Dec 09, 2025 at 08:57:21AM +0100, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote: > Dear Waldek, > > it seems that I was too hopeful. > > Unfortunately, the attached program give the following output. > It seems that the interpreter is unable to check a domain-evaluating > function parameter for its correct type. :-( > > Can this be easily fixed?
Probably not. Interpreter type checking in many places ignores categories, using 'Type' instead. I would have to investigate deeper, but at first glance the problem you see is that interpteter uses 'Type' and function declaration has more specific category. > Thank you > Ralf > > =================================================== > > %%% (1) -> d: Dom := 1 > > (1) 1 > Type: Dom > %%% (2) -> [baz1(3)(d), baz2(5)(d)] > > (2) [1, 2] > Type: List(PositiveInteger) > %%% (3) -> bar?(D1,3)(d) > There are 1 exposed and 0 unexposed library operations named bar? > having 2 argument(s) but none was determined to be applicable. > Use HyperDoc Browse, or issue > )display op bar? > to learn more about the available operations. Perhaps > package-calling the operation or using coercions on the arguments > will allow you to apply the operation. > > Cannot find a definition or applicable library operation named bar? > with argument type(s) > Type > PositiveInteger > > Perhaps you should use "@" to indicate the required return type, > or "$" to specify which version of the function you need. > > %%% (3) -> (bar?$Dom) > > (3) theMap(DOM;bar?;CIM;2,45) > Type: ((Cat, Integer) -> (Dom -> Boolean)) > %%% (4) -> (bar?$Dom)(D1,4) > There are 1 exposed and 0 unexposed library operations named bar? > having 2 argument(s) but none was determined to be applicable. > Use HyperDoc Browse, or issue > )display op bar? > to learn more about the available operations. Perhaps > package-calling the operation or using coercions on the arguments > will allow you to apply the operation. > > Cannot find a definition or applicable library operation named bar? > with argument type(s) > Type > Integer > > Perhaps you should use "@" to indicate the required return type, > or "$" to specify which version of the function you need. > > -- > 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/6ac741f1-49c4-4709-8962-f5a76203c3f3%40hemmecke.org. > )abbrev category CAT Cat > Cat: Category == with > foo: Integer -> Integer > > )abbrev domain DOM1 D1 > D1: Cat == add > foo(n: Integer) == 1 > > )abbrev domain DOM2 D2 > D2: Cat == add > foo(n: Integer) == 2 > > )abbrev domain DOM Dom > Dom(): Join(IntegerNumberSystem, CoercibleTo Integer) with > bar?: (Cat, Integer) -> % -> Boolean > baz1: Integer -> % -> Integer > baz2: Integer -> % -> Integer > == Integer add > Rep ==> Integer > coerce(x: %): Integer == x pretend Integer > bar?(D: Cat, n: Integer): % -> Boolean == (x: %): Boolean +-> > foo(n+(x::Integer))$D = 1 > baz1(n: Integer): % -> Integer == (x: %): Integer +-> foo(n+(x::Integer))$D1 > baz2(n: Integer): % -> Integer == (x: %): Integer +-> foo(n+(x::Integer))$D2 -- 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/aUgPGQyo6_coDs5q%40fricas.org.
