Can you confirm that you have studied the Aldor User Guide completely?
That's in my view the best way to understand SPAD.
I never looked into it.
Now, suppose that I study it. All right, I have heard that Aldor allows
adding categories to the library domains (as any sensible language must).
So, I shall use Aldor and declare the category Show, and then add its
instances to the domains of Integer, Product, List, Fraction, UPol --
similar as I do in Haskell.
I repeat: "That's in my view the best way to understand SPAD."
I never suggested that you use Aldor (unless it becomes free software).
With your Haskell code you are basically adding more functionality to
existing classes Integer, (), and []. The direct translation to Aldor
would be something like
-- class Show1 a where show1 :: a -> String
Show: Category == with
coerce: % -> String
--instance Show1 Integer where show1 = show
-- -- use the library operation for Integer
extend Integer: with Show == add
show(x: %): String == ... ((implementation))
Unfortunately, this does *not work* in SPAD, since SPAD is currently
still lacking the "extend" keyword.
The only option that I see (Waldek, please correct me if I am wrong) is
that you
A) go to the sources of Integer, Product, and List in the fricas source
tree add the export and the implementation of your show there and then
do everything to recompile FriCAS from scratch.
B) copy the 3 relevant source files I pointed to in my last mail to your
local directory. Add the exports and the implementation of the show
function there. Then run
build/scripts/document --tangle="domain INT Integer" --output int.spad
(you find this document script in your build directory of a previous
compilation of fricas)
Do similar things for Product, Fraction, and Lisp, etc.
Then in a running fricas session, you say
)compile int.spad
That will replace the existing Integer domain with your local one (which
by construction has the same source code + your show).
I never did (B), but I think, it should work this way.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.