Power set: Difference between revisions

Content added Content deleted
(RPL: add section)
m (RPL: add section)
Line 3,706: Line 3,706:
'''IF''' DUP SIZE
'''IF''' DUP SIZE
'''THEN''' LAST OVER SWAP GET → tail
'''THEN''' LAST OVER SWAP GET → last
≪ LIST→ 1 - SWAP DROP →LIST POWST
≪ LIST→ 1 - SWAP DROP →LIST '''POWST'''
1 OVER SIZE '''FOR''' j
1 OVER SIZE '''FOR''' j
DUP j GET tail + 1 →LIST + '''NEXT'''
DUP j GET last + 1 →LIST + '''NEXT'''
'''ELSE''' 1 →LIST '''END'''
'''ELSE''' 1 →LIST '''END'''
Line 3,716: Line 3,716:
'''POWST''' ''( { set } -- { power set } )''
'''POWST''' ''( { set } -- { power set } )''
if set is not empty
if set is not empty
then store tail
then store last item
get power set of { set } - tail
get power set of ''{ set } - last item''
for all sets of { set } - tail power set
for all sets of ''{ set } - last item'' power set
add tail to set, then set to power set
add last item to set, then set to power set
else return { { } }
else return { { } }