Power set: Difference between revisions

20 bytes added ,  11 months ago
m
→‎{{header|REXX}}: minor correction
(→‎{{header|REXX}}: Reformat and use a better /readable) version of combinations)
m (→‎{{header|REXX}}: minor correction)
Line 3,664:
End
Exit
comb: Procedure
/***********************************************************************
* Returns the combinations of size digits out of things digits
Line 3,670:
1 2/ 1 3/ 1 4/ 2 3/ 2 4/ 3 4 /
***********************************************************************/
comb: Procedure
Parse Arg things,size
n=2**things-1
list=''
Do u=1 toTo n
co=combinations(u)
If co>'' Then
list=list '/' combinations(u)
End
Return substr(space(list),2) '/' /* remove leading / */
 
combinations: Procedure Expose things size
2,295

edits