Erlang Central

SubSetGenerator

Revision as of 06:37, 7 July 2009 by TribbleFaith467 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Authors

Thomas Arts

http://www.quviq.com/

Subset Generator

Here's a simple generator that gives you a subset of the elements in a set, i.e., given a list of elements, it selects some of these elements. It shrinks to the smallest subset, the empty list.

subset(Generators) ->
   ?LET(Keep,[ {bool(),G} || G<-Generators],
	[ G || {true,G}<-Keep]).