Generating combinations without recursion Given a list of strings and a length, give all combinations of that list with the given length. The problem is: your code must not be recursive. Yes, it can be done. I have done it myself, when I had no clue what this "recursion" was.

Input: A list of strings of an undefined length, and an integer defining the length of the combination. The strings will be at least one character long, and will only contain letters or numbers. The way of input will be specified by you, the programmer.

Output: A list of possible combinations as strings, not necessarily distinct (although you can make it that way, if you like). You do not have to sort the list.

Test Cases:
As said before, the method of input will be specified by you.
[a,b] 3 -&gt; Nothing
[1,0,0] 2 -&gt; 10 10 00, or 00 10 if distinct.
[abc,bcd,cde] 2 -&gt; abcbcd abccde bcdcde

If you even manage to do this, I will commend you. As always, shortest code wins. Good luck.
GolfScript (44 42 32 chars)

n%){\,=}+[[]]@1/{`{1$+}+%}%;\,n*


This takes input on stdin as a list of newline-separated strings followed by a line containing the desired subset size. It assumes that none of the input strings is empty. It takes some inspiration from Howard's solution, and can be shortened by two chars if using his input format:

~{\,=}+[[]]@1/{`{1$+}+%}%;\,n*


Output is a newline separated list of concatenations.

E.g.

$ golfscript.rb subcombo.gs &lt;&lt;END
&gt; a
&gt; b
&gt; c
&gt; 2
&gt; END
ab
ac
bc


Note: this uses a horribly inefficient algorithm. A much nicer implementation in terms of performance is (62 61 chars)

n%)~\:S;2\?({2S,?&lt;}{:s.~)&amp;.s+.s^@4*/|}/{:x;S{;x.2/:x;1&amp;},}%n*


which uses Gosper's hack.