Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Combinations/Pop11/combinations.pop11
Normal file
17
Task/Combinations/Pop11/combinations.pop11
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
define comb(n, m);
|
||||
lvars ress = [];
|
||||
define do_combs(l, m, el_lst);
|
||||
lvars i;
|
||||
if m = 0 then
|
||||
cons(rev(el_lst), ress) -> ress;
|
||||
else
|
||||
for i from l to n - m do
|
||||
do_combs(i + 1, m - 1, cons(i, el_lst));
|
||||
endfor;
|
||||
endif;
|
||||
enddefine;
|
||||
do_combs(0, m, []);
|
||||
rev(ress);
|
||||
enddefine;
|
||||
|
||||
comb(5, 3) ==>
|
||||
Loading…
Add table
Add a link
Reference in a new issue