HaskellForMaths-0.4.1: Combinatorics, group theory, commutative algebra, non-commutative algebra

Math.Core.Utils

Description

A module of simple utility functions which are used throughout the rest of the library

Synopsis

Documentation

powersetdfs :: [a] -> [[a]]Source

Given a set xs, represented as an ordered list, powersetdfs xs returns the list of all subsets of xs, in lex order

powersetbfs :: [a] -> [[a]]Source

Given a set xs, represented as an ordered list, powersetbfs xs returns the list of all subsets of xs, in shortlex order

combinationsOf :: Int -> [a] -> [[a]]Source

Given a positive integer k, and a set xs, represented as a list, combinationsOf k xs returns all k-element subsets of xs. The result will be in lex order, relative to the order of the xs.

choose :: Integral a => a -> a -> aSource

choose n k is the number of ways of choosing k distinct elements from an n-set