From: Wai-Sun Chia Date: 2002-12-11T11:29:19+09:00 Subject: Implementing combinatorics Rubyists, Has anyone implemented combinatorics on Ruby before? i.e. Given a list; L = [x1,x2,x3....xn] What is the total number of combinations that we can produce? Rudimentary discrete math combinatorics theory tells us that it is: 2**n e.g. L = [1,2,3] [] [1] [1,2] [1,2,3] [1,3] [2] [2,3] [3] Some questions that I have: 1. Has anybody implemented this in Ruby? How would you do it? 2. Any advantage for an iterative algorithm over a recursive one? 3. Is Ruby really suitable for these type of work as opposed to say a Lisp variant, like Ocaml? TIA. -- Wai-Sun "Squidster" Chia Consulting & Integration Linux/Unix/Web Developer Dude "Just Another Ruby Miner"