https://github.com/patricknevindwyer/chunky
Extended chunking and enumeration manipulation for Elixir.
https://github.com/patricknevindwyer/chunky
elixir elixir-library fractions hex-package math oeis
Last synced: 4 months ago
JSON representation
Extended chunking and enumeration manipulation for Elixir.
- Host: GitHub
- URL: https://github.com/patricknevindwyer/chunky
- Owner: patricknevindwyer
- License: bsd-3-clause
- Created: 2019-12-08T16:59:41.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-08T14:32:27.000Z (over 5 years ago)
- Last Synced: 2025-06-03T03:57:25.033Z (4 months ago)
- Topics: elixir, elixir-library, fractions, hex-package, math, oeis
- Language: Elixir
- Size: 1.91 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
[](https://hex.pm/packages/chunky)
[](https://github.com/patricknevindwyer/chunky/blob/master/LICENSE)# Chunky
Fractions, extended Maths, Sequences, 2D Grids, Geometry, and Enumeration manipulations in Elixir.
```elixir
iex> Chunky.permutations("😀🤷🏽♀️⭐️")
[
"😀🤷🏽♀️⭐️",
"😀⭐️🤷🏽♀️",
"🤷🏽♀️😀⭐️",
"🤷🏽♀️⭐️😀",
"⭐️😀🤷🏽♀️",
"⭐️🤷🏽♀️😀"
]iex> Chunky.Math.is_prime?(30762542250301270692051460539586166927291732754961)
trueiex> Chunky.combinations(1..4, 3)
[[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]iex> Chunky.Sequence.create(Chunky.Sequence.OEIS, :a000045) |> Chunky.Sequence.take!(10)
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]iex> Chunky.Fraction.power(Chunky.Fraction.new(7, 32), Chunky.Fraction.new(30, 5))
%Chunky.Fraction{num: 117649, den: 1073741824}iex> Chunky.Fraction.power(Chunky.Fraction.new(7, 32), Chunky.Fraction.new(30, 5)) |> IO.puts()
117649/1073741824iex> Chunky.Math.prime_factors(3217644767340672907899084554130)
[1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79]iex> Chunky.Math.binomial(20, 5)
15504
```## Installation
Install by adding `chunky` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:chunky, "~> 0.13.0"}
]
end
```Chunky documentation can be found on Hexdocs at [https://hexdocs.pm/chunky](https://hexdocs.pm/chunky).
## Documentation
- [Fractions](https://hexdocs.pm/chunky/Chunky.Fraction.html#content)
- [Math](https://hexdocs.pm/chunky/Chunky.Math.html#content)
- [Sequences](https://hexdocs.pm/chunky/Chunky.Sequences.html#content)
- [Combinitorics](https://hexdocs.pm/chunky/Chunky.html#content)