RosettaCodeData/Task/Combinations/Icon/combinations-2.icon

9 lines
178 B
Plaintext

procedure lcomb(L,i) #: list combinations
local j
if i < 1 then fail
suspend if i = 1 then [!L]
else [L[j := 1 to *L - i + 1]] ||| lcomb(L[j + 1:0],i - 1)
end