An open API service indexing awesome lists of open source software.

https://github.com/bapjiws/power-set

Script with command-line arguments
https://github.com/bapjiws/power-set

Last synced: 3 months ago
JSON representation

Script with command-line arguments

Awesome Lists containing this project

README

        

This script takes a list of at least two items (single alphanumeric characters and special characters or sequences thereof) separated by single spaces and returns a power set with elements sorted by their length.
This implementation relies on binary representation of the provided list. For example, for the input a b c it constructs a list ['000', '001', '010', '011', '100', '101', '110', '111'], where 011 means that we take the last two items and 100 means we take only the first item. Similarly, for the input 1 2 3 4 it constructs ['0000', '0001', '0010', '0011', '0100', '0101', '0110', '0111', '1000', '1001', '1010', '1011', '1100', '1101', '1110', '1111'], where 1010 means we take the first and the third item.
This is obviously not the fastest possible implementation. It does what it’s supposed to, though :)