On Mon, Oct 19, 2009 at 8:00 AM, Harry Kakueki <list.push / gmail.com> wrote:
>
> def calc_new(arr,l)
>  h,t = Hash[*(0...arr.size).zip(arr).flatten],[]
>  (1..l).each do |z|
>    (0...arr.size**l).each do |x|
>      t << x.to_s(arr.size).rjust(z,"0")
>    end
>  end
>  t.uniq.sort.map{|c| c.split(//).map{|d| h[d.to_i]}.join}
> end
>
> p calc_new((1..10).to_a, 3)
>

Not always correct.
Hmmmmm.....



-- 
A Look into Japanese Ruby List in English
http://www.kakueki.com/ruby/list.html