def comb
comb = { m, list ->
    def n = list.size()
    m == 0 ?
        [[]]:
        (0..(n-m)).inject([]) { newlist, k ->
            def sublist = (k+1 == n) ? []: list[(k+1)..<n] 
            newlist += comb(m-1, sublist).collect { [list[k]] + it }
        }
}