tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
8
Task/Power-set/Forth/power-set.fth
Normal file
8
Task/Power-set/Forth/power-set.fth
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
: ?print dup 1 and if over args type space then ;
|
||||
: .set begin dup while ?print >r 1+ r> 1 rshift repeat drop drop ;
|
||||
: .powerset 0 do ." ( " 1 i .set ." )" cr loop ;
|
||||
: check-none dup 2 < abort" Usage: powerset [val] .. [val]" ;
|
||||
: check-size dup /cell 8 [*] >= abort" Set too large" ;
|
||||
: powerset 1 argn check-none check-size 1- lshift .powerset ;
|
||||
|
||||
powerset
|
||||
Loading…
Add table
Add a link
Reference in a new issue