Hi there, On Fri, May 21, 2010 at 03:24:47AM -0700, Alasdair wrote: > Since the current Sage implementation of derangements is a wrapper for > a GAP function, and doesn't always work as you'd like, I've bunged the > first draft of a more complete native implementation of derangements > up as ticket #9005.
I think this should be cross posted in sage-combinat... Since this is clearly combinatorics. A first glance at your patch tells me that your primary interest is to enumerates (ie: list count, random...) derangement. You don't need an extra datastructure but usual permutations. So basically you want to build what we calle an "enumerated set". please see the files sets/category/finite_enumerated_sets.py and sets/category/examples/finite_enumerated_sets.py primarily the goal of these two categories is to fix a common interface (i.e. for example, count should be called cardinality...) and to tests that methods are consistent (list should return a list whose length is equal to cardinality for example). Please feel free to ask if you have some trouble. Cheers, Florent -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
