http://www.risc.jku.at/people/hemmecke/AldorCombinat/

Could you point me to the part which deals with defining inductive
types?

No. The definition of inductive types is entirely inherited from Aldor.

Search for the section "Test Recursive Structures".

You'll find something like

testRecursive1(): () == {
        macro {
                E == EmptySetSpecies;
                X == SingletonSpecies;
                + == Plus;
                * == Times;
        }

        A(L: LabelType): CombinatorialSpecies L == (E + X*A*A)(L) add;
        check(
            A,
            [1, 1, 4, 30, 336, 5040],
            [1, 1, 2, 5, 14, 42],
            [1, 1, 2, 5, 14, 42]
        );
}

And the line that starts with A(...) is all to define an inductive type.
(I only used macros to make it look nicer.)

At the beginning I had some problem, but the "add" at the end of the
line makes this whole definition lazy and thus working.

I have not yet tried something like this in SPAD. And as you can see, in
this particular case, the result type depends on the input L.

Also I would be interested in your more general views on the
suitability of certain languages for this type of programming.

I'm currently looking deeper into Haskell, but my interest is more the
algebraic part not so much higher categorial stuff. So my view might not
count for your interest.

Anyway, being lazy, Haskell has some nice and simple ways to define
recursive structures. But I still think, it's not suitable for Computer
Algebra.

Maybe an advantage of Aldor/SPAD in contrast to Haskell is the two level
type hierarchy, i.e. domains vs. categories. Maybe I don't yet know
Haskell well enough, but I don't see it in Haskell.

example Saul Youssef code at:
http://axiom-wiki.newsynthesis.org/SandBoxAldorCategoryTheoryCategories?root=SandBox%20Aldor%20Category%20Theory
seems less than ideal?

This is very advanced code that stresses the compiler. I don't know what in particular one can actually compute with it, but it's nice to see Aldor's expressiveness.

What I would really like to work out is why things like this Haskell
code:

   class Monad m where
    unit :: a ->  m a
    mult :: m (m a) ->  m a

which are so powerful seem to be hard to do in SPAD related languages?

Does the above express something similar to

#include "aldor"
Monad(C: Category, A: C, M: C -> C): Category == with {
  unit: A -> M A;
  mult: M M A -> M A;
}

? That's compiling in Aldor, but as such is pretty useless. You would have to give some implementation of that category.

But what I've written above, is actually not really, what I imagine you want. In fact, in the end, you might want something like this:

Monad(C: Category, 1: C -> C, M: C -> C): Category == with {
  unit: 1 -> M;
  mult: (M, M) -> M;
}

(which doesn't compile in aldor).

It would help if I understood what it is about the above Haskell
class that makes it so difficult to represent in SPAD. Is it somthing
about allowing partial types to be combined to form a complete type?
I just can't work it out.

The Haskell class alone doesn't help much. What do you want to achieve? You might want to write a Haskell program (with monads) and explain what it does and only then we can try to represent it in SPAD.

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.

Reply via email to