Power set: Difference between revisions

1,098 bytes added ,  3 years ago
→‎{{header|Quackery}}: Added commentary.
(Added Quackery.)
(→‎{{header|Quackery}}: Added commentary.)
Line 3,284:
 
=={{header|Quackery}}==
 
Quackery is, when seen from a certain perspective, an assembly language that recognises
only three types, "operators", which correspond to op-codes, "numbers" i.e. bignums, and
"nests" which are ordered sequences of zero of more operator, bignums and nests. Everything
else is a matter of interpretation.
 
Integers can be used as a set of natural numbers, with (in binary) 0 corresponding to the
empty set, 1 corresponding to the set of the natural number 1, 10 corresponding to the set
of the natural number 2, 11 corresponding to the set of the natural numbers 1 and 2, and so
on. With this sort of set, enumerating the powerset of the numbers 0 to 4, for example
simply consists of enumerating the numbers 0 to 15 inclusive. Operations on this sort of
set, such as union and intersection, correspond to bitwise logic operators.
 
The other way of implementing sets is with nests, with each item in a nest corresponding
to an item in the set. This is computationally slower and more complex to code, but has the
advantage that it permits sets of sets, which are required for this task.
 
<lang Quackery> [ stack ] is (ps).stack
1,478

edits