Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Combinations/Lambdatalk/combinations.lambdatalk
Normal file
18
Task/Combinations/Lambdatalk/combinations.lambdatalk
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{def comb
|
||||
{def comb.r
|
||||
{lambda {:m :n :N}
|
||||
{if {= :m 0}
|
||||
then {A.new {A.new}}
|
||||
else {if {= :n :N}
|
||||
then {A.new}
|
||||
else {A.concat
|
||||
{A.map {{lambda {:n :rest} {A.addfirst! :n :rest}} :n}
|
||||
{comb.r {- :m 1} {+ :n 1} :N}}
|
||||
{comb.r :m {+ :n 1} :N}}}}}}
|
||||
{lambda {:m :n}
|
||||
{comb.r :m 0 :n}}}
|
||||
-> comb
|
||||
|
||||
{comb 3 5}
|
||||
-> [[0,1,2],[0,1,3],[0,1,4],[0,2,3],[0,2,4],[0,3,4],
|
||||
[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue