-------- Original-Nachricht --------
> Datum: Mon, 30 Jun 2008 00:46:04 +0900
> Von: Dan __ <major_general_joe / hotmail.com>
> An: ruby-talk / ruby-lang.org
> Betreff: Re: Recursive Logic - Examples and Resources?

> Matt Darby wrote:
> >> So, if the set is 1 2 3 4 5 6 7 8 9 10, and User1 has (9, 17), while
> >> User2 has (3, 7), User2 could be part of the set, while User1 could
> not.
> > 
> > This approach is pretty naive, but it might work:
> > 
> > range = 0...10
> > User.find(:all, :conditions => ["num1 IN (?) and num2 IN (?)", range,
> > range])
> 
> Thanks for the suggestion Matt, it seems like a good start.  That seems 
> like it would just return every user that fit into the set though, and 
> not five to make up a set.  As well, I'd like to avoid using SQL code if 
> I could, because I'm not sure which database the final app will use/how 
> often it'll switch (its using PostgreSQL right now, but that might have 
> to switch depending on hosting, etc.).
> -- 
> Posted via http://www.ruby-forum.com/.

Dan,

maybe you'll need constraint programming with set constraints then.
Have a look at Gecode and its Ruby bindings gecoder then.

http://gecoder.rubyforge.org/documentation/constraints/set-constraints.html

Best regards,

Axel 
-- 
Psssst! Schon vom neuen GMX MultiMessenger geh÷˛t?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger