Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Power-set/Factor/power-set-1.factor
Normal file
5
Task/Power-set/Factor/power-set-1.factor
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
USING: kernel prettyprint sequences arrays sets hash-sets ;
|
||||
IN: powerset
|
||||
|
||||
: add ( set elt -- newset ) 1array <hash-set> union ;
|
||||
: powerset ( set -- newset ) members { HS{ } } [ dupd [ add ] curry map append ] reduce <hash-set> ;
|
||||
19
Task/Power-set/Factor/power-set-2.factor
Normal file
19
Task/Power-set/Factor/power-set-2.factor
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
( scratchpad ) HS{ 1 2 3 4 } powerset .
|
||||
HS{
|
||||
HS{ 1 2 3 4 }
|
||||
HS{ 1 2 }
|
||||
HS{ 1 3 }
|
||||
HS{ 2 3 }
|
||||
HS{ 1 2 3 }
|
||||
HS{ 1 4 }
|
||||
HS{ 2 4 }
|
||||
HS{ }
|
||||
HS{ 1 }
|
||||
HS{ 2 }
|
||||
HS{ 3 }
|
||||
HS{ 4 }
|
||||
HS{ 1 2 4 }
|
||||
HS{ 3 4 }
|
||||
HS{ 1 3 4 }
|
||||
HS{ 2 3 4 }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue