This is a permutation, those aren't, was Re: XQuery (not XPath 2.0, or XPath 1.0) permutations

Hi Leigh,

The author of the blog you cited is confused about what a permutation is. 
His code generated the power set of the given set, not the permutation 
set.

For the set of four elements {a, b, c, d} he showed, there are 4!=24 
permutations, each of which has all four elements in a different order. 
Here's what they look like:

{a, b, c, d}
{a, b, d, c}
...
{d, c, b, a}

The problem we were discussing this morning was to randomly generate one 
permutation of a set of numbers so that the rearranged order of the 
numbers could be used as a lens to rearrange a set of choices presented by 
the itemset of a select or select1.

I just posted a blog entry [1] that shows the XForms needed to generate a 
permutation and then apply it to the itemset of a select1.

[1] 
https://www.ibm.com/developerworks/mydeveloperworks/blogs/JohnBoyer/entry/randomizing_the_responses_to_a_survey_question_in_xforms29

Cheers,
John M. Boyer, Ph.D.
Distinguished Engineer, IBM Forms and Smarter Web Applications
IBM Canada Software Lab, Victoria
E-Mail: boyerj@ca.ibm.com 

Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
Blog RSS feed: 
http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw





From:   "Leigh L. Klotz, Jr." <Leigh.Klotz@Xerox.com>
To:     public-forms@w3.org, john.boyer@ca.ibm.com
Date:   09/21/2011 09:25 AM
Subject:        XQuery (not XPath 2.0, or XPath 1.0) permutations
Sent by:        public-forms-request@w3.org



http://blog.davidcassel.net/2010/05/calling-a-function-on-all-permutations-of-a-sequence/ 

Received on Wednesday, 21 September 2011 21:33:45 UTC