Anonymous user
Power set: Difference between revisions
Updated to Nim 1.4: changed initSet to initHashSet, to Set to toHashSet. Also changed some variable names and some other things.
m (→{{header|Wren}}: Correction to preamble.) |
(Updated to Nim 1.4: changed initSet to initHashSet, to Set to toHashSet. Also changed some variable names and some other things.) |
||
Line 2,401:
=={{header|Nim}}==
<lang nim>import sets, hashes
proc hash(x: HashSet[int]): Hash =
var h = 0
for i in x: h = h !& hash(i)
result = !$h
proc powerset[T](inset: HashSet[T]):
result
let previous = result
▲ for i in inset:
▲echo powerset(toSet([1,2,3,4]))</lang>
=={{header|Objective-C}}==
|