3 ms·
Here is Lisp code [1] that maps all sorts of combinatorial objects—permutations, combinations, radix-R integers, multi-set arrangements, etc.—perfectly into the
by reikonomusha 3y ago
Here is Lisp code [1] that maps all sorts of combinatorial objects—permutations, combinations, radix-R integers, multi-set arrangements, etc.—perfectly into the smallest set of integers [0, n-1] and back. (In a sense, they are perfect hash functions.) This is used to help efficiently solve combinatorial puzzles.
[1] https://github.com/stylewarning/cl-permutation/blob/master/src/combinatorial-ranking.lisp https://github.com/stylewarning/cl-permutation/blob/master/s...
- 082349872349872 3y agosee also http://www.sudleyplace.com/APL/A%20Combinatorial%20Operator%20in%20APL.pdf http://www.sudleyplace.com/APL/A%20Combinatorial%20Operator%... > The goal of this document is to describe a single APL primitive to both count and generate various Combinatorial Arrays: permutations, combinations, compositions, partitions, etc. The unifying (and very APL-like) principle for such a primitive is Gian-Carlo Rota's Twelvefold Way as described in Richard Stanley's "Enumerative Combinatorics", Knuth’s TAoCP, Vol. 4A, and Wikipedia among other references.