home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
unix
/
volume10
/
ifp
/
part01
/
fproot
/
demo
/
PowerSet
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS
UTF-8
Wrap
Text File
|
1987-07-05
|
415 b
|
25 lines
(*
* PowerSet
*
* This function generates all subsets of a given set. Sets are
* represented as sequences of distinct elements.
*
* Examples:
*
* <> : PowerSet -> <<>>
*
* <a b c> : PowerSet -> <<a,b,c>,<a,b>,<a,c>,<a>,<b,c>,<b>,<c>,<>>
*)
DEF PowerSet AS
IF null THEN [id]
ELSE
[1, tl | PowerSet] |
[
distl | EACH apndl END,
2
]
| cat
END;