Yeah variable number of option groups, currently working with PHP.

On Wed, Apr 1, 2009 at 1:07 AM, Mark Ratjens <[email protected]> wrote:
> OK ... so how many option groups? are they variable? what language are you
> trying to express this in?
>
> Torm3nt wrote:
>
> Unfortunately it doesn't quite work that straight forward when the
> number of the different option groups = n =P
>
>
> On Wed, Apr 1, 2009 at 12:52 AM, Mark Ratjens
> <[email protected]> wrote:
>
>
> Hmm ... what idioms are we allowed then? :-)
>
> Iterate over the sizes
>    within each size
>       iterate over the colours
>          make a combination and stow it somewhere
>
> Does that make sense?
>
> Either that or get some sleep :-)
>
> Torm3nt wrote:
>
>
> This may seem rather simple to some, but being late at night it's
> driving me up the wall..
>
> The context behind this is I'm trying to create all unique product
> options for a product.
>
> Consider:
>
> We have two product option groups, size and colour.
>
> Size contains: S, M, L, XL
> Colour contains: red, blue, green, black, brown
>
> I need to write an algorithm (this isn't for ruby btw, so no ruby
> idioms =P), that gets all unique combinations, for example:
>
> S red, S blue, S green, S black, S brown
> M red, M blue.etc.etc.
>
> They're all valid, but I can't then go:
>
> red S - it's exactly the same option as before.
>
> I have tried to do this three different ways and each way I've hit a daed
> end.
>
>
> HELP!
>
> =)
>
>
>
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to