Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinkavik/elm-combinatorics
Combinations, Permutations and Variations in Elm language
https://github.com/martinkavik/elm-combinatorics
combinations combinatorics elm factorial permutations variations
Last synced: 12 days ago
JSON representation
Combinations, Permutations and Variations in Elm language
- Host: GitHub
- URL: https://github.com/martinkavik/elm-combinatorics
- Owner: MartinKavik
- License: mit
- Created: 2017-12-17T23:04:25.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-18T12:20:12.000Z (about 7 years ago)
- Last Synced: 2024-10-05T04:41:08.304Z (3 months ago)
- Topics: combinations, combinatorics, elm, factorial, permutations, variations
- Language: Elm
- Homepage: http://package.elm-lang.org/packages/MartinKavik/elm-combinatorics/latest
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Combinations, Permutations and Variations in Elm
Modules and their functions:
**Combinatorics.Counts**
```elm
countVariationsWithReps 2 3 == Ok 9countVariations 2 3 == Ok 6
countPermutationsWithReps [ 2, 2 ] == Ok 6
countPermutations 3 == Ok 6
countCombinationsWithReps 2 4 == Ok 10
countCombinations 2 4 == Ok 6
```**Combinatorics.Lists**
```elm
getVariationsWithReps 2 [ "a", "b" ] == Ok [["a","a"],["a","b"],["b","a"],["b","b"]]getVariations 2 [ "a", "b" ] == Ok [["a","b"],["b","a"]]
getPermutationsWithReps [ ( "a", 1 ), ( "b", 2 ) ] == Ok [["a","b","b"],["b","a","b"],["b","b","a"]]
getPermutations [ "a", "b" ] == Ok [["a","b"],["b","a"]]
getCombinationsWithReps 2 [ "a", "b" ] == Ok [["a","a"],["a","b"],["b","b"]]
getCombinations 2 [ "a", "b", "c" ] == Ok [["a","b"],["a","c"],["b","c"]]
```**Combinatorics.Helpers**
```elm
factorial 5 == Ok 120isValidResult (Err "some error") == False
```