Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Variant permutation

by hossman (Prior)
on Aug 31, 2003 at 07:29 UTC ( #287994=note: print w/replies, xml ) Need Help??

in reply to Variant permutation

I'm curious...

  1. Why do you need these "Variant permutations" ? ... is there a practicle use for this, or are you just interested from a theoreticaly standpoint?
  2. Why are you limiting yourself to (what i would call) "permutation prefixes" ?

If you asked me to "to report the partial permutation of the values...

a b c
1 2 3
x y z list would include "ax", "1x", "1", "x", etc.

Replies are listed 'Best First'.
Re: Re: Variant permutation
by gmax (Abbot) on Aug 31, 2003 at 09:37 UTC

    An example would be better than any explanation.

    my $headers = { locations => ['USA', 'UK'], departments => ['pers', 'dev','sales'], gender => ['m', 'f'] }; __END__ The ultimate goal will be USA UK + ---------------------------------- --------------------------------- pers dev sales USA pers dev sales UK -------- ------- --------- ------- -------- ------- --------- ------ m f pers m f dev m f sales m f USA m f pers m f dev m f sales m f UK - - --- - - --- - - ----- - - --- - - ---- - - --- - - ----- - - -- a b c d e f g h i j k l m n o p q r s t u v w x

    Take this schema, and see why I said that order is important and I take the variation only when the last one is changing.

    For every location I list the departments; for each department a breakdown by gender (columns a b d e n o p q s t), followed by a department total (columns c f i o r u). Then there is a breakdown by location (columns g h v w) with its grand total (columns l x).

    If I permute 'USA'-'m' before 'USA'-'pers'-'m' I am breaking the schema.

    The algorithm I am dealing with is a little more complex than this, since it is taking information about where to find each item, and generating code to retrieve the relevant data from a database.

    The permutations are needed to create the appropriate conditions for retrieving each column of data. All the conditions are merged together into a giant SQL statement that will fetch the data according to my instructions (SUM, COUNT, AVG).

    More on this subject when I adjust nicely all the above into a module. :)

     _  _ _  _  
    (_|| | |(_|><

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://287994]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-06-18 16:07 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (110 votes). Check out past polls.