On Mon, Feb 23, 2026 at 11:04:04PM +0100, Grégory Vanuxem wrote:
> Hello,
>
> I have two very simple domains, an anonymous function domain and a
> named function domain, but one barfs with a strange error, see below.
> Any idea what that means? The anonymous function domain "works" fine.
> Not the other one. The code is almost the same, only the difference
> AnonymousFunction//FunctionCalled(Symbol).
>
> (1) -> )di op jfunc
>
> There are 2 exposed functions called jfunc :
> [1] String -> JLObjFunction from JLObjFunction
>
> >> Error detected within library code:
> Improper script count in symbol
You have:
jfunc : FunctionCalled(Symbol) -> %
This causes trouble: argument to 'FunctionCalled' should be a symbol,
but you pass 'Symbol' which is a type (and not a symbol). Such
mismatch is a weakness in current FriCAS typechecker, checks that
arguments to types have correct type are delayed and some things
(like this one) go trough unchecked.
In your command display code assumes that you have correct type,
and seeinf 'FunctionCalled' tries to convert its argument to
OutputForm. So, FriCAS calls "coerce : Symbol -> OutputForm'.
But 'Symbol' is internally represented by Lisp list '(Symbol)'.
FriCAS symbol handling code assumes that this is a scripted
symbol, but then realizes that there are no scipts. So you
get appropriate error message.
BTW: 'FunctionCalled' and few similar things are part of interpeter
type inference/coercion machinery. Namely, 'FunctionCalled'
is internal representation of effectively untyped function.
This internal representation will give true function only after
coercion to appropriate function type (such coercions are done
behind the scenes by the interpreter). Normally such types should
not be used by algebra functions. You may have reasons to use this
type, but it is awkward to use from algebra: either you hardcode
name (and hope that you are not affected by troubles due to
types in signatures) or parameter to 'FunctionCalled' must be
a parameter to your domain. Normally FriCAS will not invent
parameters to domains, so you will need a lot of explicit
qualification when using your constructor. And you will have
to deal with internal representation.
--
Waldek Hebisch