Power set: Difference between revisions
Content added Content deleted
Line 1,652: | Line 1,652: | ||
def powerSetRec(head, tail) { |
def powerSetRec(head, tail) { |
||
if (!tail) return [head] |
if (!tail) return [head] |
||
powerSetRec(head, tail.tail()) + powerSetRec(head + tail.head(), tail.tail()) |
powerSetRec(head, tail.tail()) + powerSetRec(head + [tail.head()], tail.tail()) |
||
} |
} |
||