Jump to content

Anyone have a PERMUTATIONS function?


This topic is 6889 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Basically, what I am looking for is a custom function that can take a value list and create every permutation of the items in the value list. Say I have a value list "cat;dog;mouse", I want to be able to feed the custom function that value list and get:

cat dog mouse

cat mouse dog

dog cat mouse

dog mouse cat

mouse cat dog

mouse dog cat

The order of the permutations doesn't matter as long as all the permutations are returned. Also, the number of values in the list I feed it is variable. One time it may be three values as above, another time it may be four and so on.

Anybody help? I have been staring at my screen for hours. I am hoping this is easy for someone.

Link to comment
Share on other sites

A recursive function recurs, i.e. loops until a condition is met. Somewhat similar to a looping script with Exit Loop If[]. In Developer7 you can write custom functions, and a custom function can call itself, thus being recursive.

Example:

Custom Function:

CountFromTo ( start ; end )

Returns a comma-separated list of integers starting from start and ending with end.

Case (

start <= end ;

start & ", " & CountFromTo ( start + 1 ; end )

)

Link to comment
Share on other sites

  • 3 months later...

This topic is 6889 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.