September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
13
Task/Ordered-Partitions/Zkl/ordered-partitions-1.zkl
Normal file
13
Task/Ordered-Partitions/Zkl/ordered-partitions-1.zkl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
fcn partitions(args){
|
||||
args=vm.arglist;
|
||||
s:=(1).pump(args.sum(0),List); // (1,2,3,...)
|
||||
fcn(s,args,p){
|
||||
if(not args) return(T(T));
|
||||
res:=List();
|
||||
foreach c in (Utils.Helpers.pickNFrom(args[0],s)){
|
||||
s0:=s.copy().removeEach(c);
|
||||
foreach r in (self.fcn(s0,args[1,*])){ res.append(T(c).extend(r)) }
|
||||
}
|
||||
res
|
||||
}(s,args)
|
||||
}
|
||||
4
Task/Ordered-Partitions/Zkl/ordered-partitions-2.zkl
Normal file
4
Task/Ordered-Partitions/Zkl/ordered-partitions-2.zkl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
args:=vm.arglist.apply("toInt"); // aka argv[1..]
|
||||
if(not args) args=T(2,0,2);
|
||||
partitions(args.xplode()).pump(Console.println,Void);
|
||||
// or: foreach p in (partitions(1,1,1)){ println(p) }
|
||||
Loading…
Add table
Add a link
Reference in a new issue