Power set: Difference between revisions

(Undo revision 187701 by Siskus There is no _requirement_ for the use of an empty set as an example in the task.)
Line 811:
<lang funl>import lists.foldr
 
def powerset( s ) = foldr( (\x, acc) -> acc + map( a -> {x} + a, acc), {{}}, s )
 
println( powerset({1, 2, 3, 4}) )</lang>
Anonymous user