List the combinations of elements in a set Given a set of n elements, the challenge is to write a function who lists all the combinations of k elements of in this set.

Example

Set: [1, 7, 4]
Input: 2
Output: [1,7], [1,4], [7,4]


Example

Set: ["Charlie", "Alice", "Daniel", "Bob"]
Input: 2
Output ["Daniel", "Bob"], ["Charlie", "Alice"], ["Alice", "Daniel"], ["Charlie", "Daniel"], ["Alice", "Bob"], ["Charlie",  "Bob"]


Rules (Edited)


The order of the output is of your choice.
The input may be any type of data. But the output should be the same type as the input. If the input is a list of integers, the output should be a list of integers as well. If the input is a string (array of characters), the output should be a string as well.
The code should work with any number of input variables.
You can use any programming language.
The answer should be able to use anything (string, int, double...) as input and output as well.
Any built-in functions that is related to combinations and permutations are forbidden.
Shortest code wins (in terms of bytes).
Tiebreaker: votes.
Duration: 1 week.


P.S. Be careful about the extreme inputs such as negative numbers, 0, etc.
Haskell - 57 46 bytes
Bring it on, golfscripters.
0%_=[[]]
n%(x:y)=map(x:)((n-1)%y)++n%y
_%_=[]

Use case (same function works polymorphicaly):

2%[1,2,3,4] ➔ [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
3%&quot;cheat&quot; ➔ [&quot;che&quot;,&quot;cha&quot;,&quot;cht&quot;,&quot;cea&quot;,&quot;cet&quot;,&quot;cat&quot;,&quot;hea&quot;,&quot;het&quot;,&quot;hat&quot;,&quot;eat&quot;]
2%[&quot;Charlie&quot;, &quot;Alice&quot;, &quot;Daniel&quot;, &quot;Bob&quot;] ➔
[[&quot;Charlie&quot;,&quot;Alice&quot;],[&quot;Charlie&quot;,&quot;Daniel&quot;],[&quot;Charlie&quot;,&quot;Bob&quot;],[&quot;Alice&quot;,&quot;Daniel&quot;],[&quot;Alice&quot;,&quot;Bob&quot;],[&quot;Daniel&quot;,&quot;Bob&quot;]]