One trick that sometimes work is writing package body like:
if LLZZ has _< : (LLZZ, LLZZ) -> Boolean then
kleiner(x: LLZZ, y: LLZZ): Boolean == x <$LLZZ y
That compiles, but apparently does not work. Which means that
Spad runtime has trouble finding '<'.
Deeper analysis shows that the message above has some merit: compiler
uses an utility function to check if conditions are statisfied.
For '<' there are two conditions: argument of the domain has
OrderedSet and domain (that is %) had finiteAggregate. Argument
of domain is List(Integer) and in this case check that % has
finiteAggregate fails. This failure is because condition
checking code does not properly track changing meaning of %
and at that point % is still your package (which does not have
finiteAggregate).
This is a bug in Spad compiler, I am noit sure how much effort
it will take to fix it.
And to literally answer your question, the following compiles
and AFAICS generates right code:
)abbrev package FOO Foo
ZZ ==> Integer
LZZ ==> List ZZ
LLZZ ==> List LZZ
Foo: finiteAggregate with
kleiner: (LLZZ, LLZZ) -> Boolean
== add
kleiner(x: LLZZ, y: LLZZ): Boolean == x <$LLZZ y
Of course, declaring that your package has finiteAggregate makes
no sense, but this is condition is checked due to bug...
--
Waldek Hebisch