Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -3,13 +3,13 @@ m = 3
|
|||
len result[] m
|
||||
#
|
||||
proc combinations pos val . .
|
||||
if pos <= m
|
||||
for i = val to n - m
|
||||
result[pos] = pos + i
|
||||
combinations pos + 1 i
|
||||
.
|
||||
else
|
||||
if pos > m
|
||||
print result[]
|
||||
return
|
||||
.
|
||||
for i = val to pos + n - m
|
||||
result[pos] = i
|
||||
combinations pos + 1 i + 1
|
||||
.
|
||||
.
|
||||
combinations 1 0
|
||||
combinations 1 1
|
||||
|
|
|
|||
16
Task/Combinations/FutureBasic/combinations.basic
Normal file
16
Task/Combinations/FutureBasic/combinations.basic
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
void local fn Combinations( currStr as CFStringRef, start as int, stp as int, depth as int )
|
||||
int i
|
||||
|
||||
for i = start to stp
|
||||
if depth = 0 then printf @"%@ %d", currStr, i
|
||||
fn Combinations( fn StringWithFormat( @"%@ %d", currStr, i ), i+1, stp, depth-1 )
|
||||
next
|
||||
end fn
|
||||
|
||||
int n : n = 3
|
||||
int m : m = 5
|
||||
|
||||
printf @" %d combinations of integers 0 through %d are:", n, m-1
|
||||
fn Combinations( @"", 0, m-1, n-1 )
|
||||
|
||||
HandleEvents
|
||||
1
Task/Combinations/J/combinations-10.j
Normal file
1
Task/Combinations/J/combinations-10.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
combb=: (#~ ((-:/:~)>/:~-:\:~)"1)@(# #: [: i. ^~)
|
||||
|
|
@ -1,7 +1 @@
|
|||
combr=: dyad define
|
||||
if.(x=#y) +. x=1 do.
|
||||
y
|
||||
else.
|
||||
(({.y) ,. (x-1) combr (}.y)) , (x combr }.y)
|
||||
end.
|
||||
)
|
||||
combr=: ((0,.$:&.<:),1+($:<:))` ([:i.<:,[) @.(>:+.0=[)M.
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
combb=: (#~ ((-:/:~)>/:~-:\:~)"1)@(# #: [: i. ^~)
|
||||
combr1=: dyad define
|
||||
if.(x=#y) +. x=1 do.
|
||||
y
|
||||
else.
|
||||
(({.y) ,. (x-1) combr (}.y)) , (x combr }.y)
|
||||
end.
|
||||
)
|
||||
|
|
|
|||
1
Task/Combinations/J/combinations-8.j
Normal file
1
Task/Combinations/J/combinations-8.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
combr1=: (({.@],.<:@($:}.)),($:}.))` ] @.((= #)+.1=[)
|
||||
1
Task/Combinations/J/combinations-9.j
Normal file
1
Task/Combinations/J/combinations-9.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
comb3=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^)
|
||||
10
Task/Combinations/Uiua/combinations.uiua
Normal file
10
Task/Combinations/Uiua/combinations.uiua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# both from https://github.com/Omnikar/uiua-math/blob/main/lib.ua
|
||||
PowerSet ← ⍚▽⋯⇡ⁿ:2⧻⟜¤
|
||||
Perms ← ☇1⍉∧(≡↻⇡⟜↯+1⟜⊂):¤¤°⊂
|
||||
|
||||
Permute ← ≡⊏⊙¤⊸(Perms⇡⧻) # Optional helper function.
|
||||
|
||||
# Order is unimportant here. If order is important prepend `☇1≡Permute` to the results.
|
||||
Choose ← ≡°□▽=⊙(⊸(≡◇⧻)PowerSet)
|
||||
|
||||
⊏⊸⍏Choose 3 ⇡5 # Choose and sort results
|
||||
Loading…
Add table
Add a link
Reference in a new issue