On Tue, May 10, 2011 at 05:00:29AM -0700, Bruce wrote:
>    My main problem now is that I don't know how to implement a new parent.
>    Specifically a new monoid. I have looked at FreeMonoid and all I really
>    got out of this was how to call the function.

Note:

       sage: M = Monoids().example()

has nothing to do with FreeMonoid. The former is a basic
implementation meant as an example to implement new monoids. The
latter is a more full featured implementation (which by the way is not
yet refactored to use categories) .

Please use introspection to find the sources for M:

       sage: M??

This will actually point you to sage/categories/examples/monoids.py

>    I am still unclear about parents and categories. As I understand it these
>    must be implemented using classes
>    (including abstract classes and/or metaclasses which are still classes).

Yup. In principle you should not have to worry about metaclasses
(there is one behind the scene, but for a fairly localized technical
detail).

>    Looking in FreeMonoid I find FreeMonoid_class and FreeMonoidFactory. I
>    don't know what a factory is so I have to guess.
>    My guess is that it is a function that returns a class. This would then
>    give a construction of classes depending on parameters
>    (for FreeMonoid the parameters are the set of generators).

Yes. See http://en.wikipedia.org/wiki/Factory_method_pattern.

The Monoids().example() implementation does not need it though.

>    To construct a single monoid I would expect to define a class
>    whose parent is Monoid and then to write the class methods (in
>    this case one, returning the unit and mul, returning the
>    product).  There are several things Monoid or Monoids and I don't
>    know what their roles are.
>
>    However I would really want to construct monoids depending on
>    parameters (which I would have thought was typical) and I don't
>    know where to start with this.

Please have a look at sage/categories/examples/monoids.py, and get
back to us for things that will still need clarification.

>    I am amazed that posets is immutable. How is that done?

The covering relations are computed, and this is used as a key to a
caching function when constructing a poset.

>    I have not yet discovered how labelled posets are constructed.
>    Have I missed something?

The current Poset implementation does not support labels indeed. If
you need thouse, you will need to use a DiGraph instead.

>    Thank you for your patience with me.

You are welcome.

Cheers,
                                Nicolas
--
Nicolas M. ThiĆ©ry "Isil" <[email protected]>
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" 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/sage-combinat-devel?hl=en.

Reply via email to