Recursive functions

William J. schrieb:

triplets.each do |ary| (3**ary.size).times{ |i|
word = (num_to_str(i,3,ary)); p word if dict[word] }
end

One more improvement:

def num_to_str( n, base, ary )
n.to_s(base).rjust(ary.size,“0”).split(’’).zip( ary ).
inject(""){|out,(i,s)| out << i.tr(“0-9a-z”,s) }
end

Regards,
Pit