[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Working with generic functions
- To: firstname.lastname@example.org
- Subject: Working with generic functions
- From: Kenneth Knight <email@example.com>
- Date: Wed, 2 Dec 92 13:58:28 EST
This is a bit of a change from the message that have been posted
lately, but I can't seem to find the answer myself so here goes...
I am writing methods to do some basic combinatorics (permutation, r-permutation
, combinations, and so on). The problem is that I'd like to access the 'permute'
function in two ways: 1. as P(n) for permuting an entire set of objects; and,
2. as P(n,r) for permuting n objects in r subsets. I have factorial written
and it works. My problem is that from what I can tell (and what Thomas,
thank Mark Feeley for a nice embedded version) I can not create two methods
called 'permute' with different number of parameters. The param-lists are
not congruent. I would very much like to call both of the functions 'permute'
but I do not want the aggrivation of having to type (permute 6 6) to find out
how many permutations are in a 6 objet set. Is there a way I can manage this?
** Ken **