- From: John Boyer <boyerj@ca.ibm.com>
- Date: Wed, 21 Sep 2011 14:32:51 -0700
- To: "Leigh L. Klotz, Jr." <Leigh.Klotz@Xerox.com>
- Cc: public-forms@w3.org
- Message-ID: <OF3D4B76D6.6E6D4422-ON88257912.00717730-88257912.00765D7E@ca.ibm.com>
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