项目作者: patricknevindwyer

项目描述 :
Extended chunking and enumeration manipulation for Elixir.
高级语言: Elixir
项目地址: git://github.com/patricknevindwyer/chunky.git
创建时间: 2019-12-08T16:59:41Z
项目社区:https://github.com/patricknevindwyer/chunky

开源协议:BSD 3-Clause "New" or "Revised" License

下载


Hex version badge
License badge

Chunky

Fractions, extended Maths, Sequences, 2D Grids, Geometry, and Enumeration manipulations in Elixir.

  1. iex> Chunky.permutations("😀🤷🏽‍♀️⭐️")
  2. [
  3. "😀🤷🏽‍♀️⭐️",
  4. "😀⭐️🤷🏽‍♀️",
  5. "🤷🏽‍♀️😀⭐️",
  6. "🤷🏽‍♀️⭐️😀",
  7. "⭐️😀🤷🏽‍♀️",
  8. "⭐️🤷🏽‍♀️😀"
  9. ]
  10. iex> Chunky.Math.is_prime?(30762542250301270692051460539586166927291732754961)
  11. true
  12. iex> Chunky.combinations(1..4, 3)
  13. [[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]
  14. iex> Chunky.Sequence.create(Chunky.Sequence.OEIS, :a000045) |> Chunky.Sequence.take!(10)
  15. [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
  16. iex> Chunky.Fraction.power(Chunky.Fraction.new(7, 32), Chunky.Fraction.new(30, 5))
  17. %Chunky.Fraction{num: 117649, den: 1073741824}
  18. iex> Chunky.Fraction.power(Chunky.Fraction.new(7, 32), Chunky.Fraction.new(30, 5)) |> IO.puts()
  19. 117649/1073741824
  20. iex> Chunky.Math.prime_factors(3217644767340672907899084554130)
  21. [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79]
  22. iex> Chunky.Math.binomial(20, 5)
  23. 15504

Installation

Install by adding chunky to your list of dependencies in mix.exs:

  1. def deps do
  2. [
  3. {:chunky, "~> 0.13.0"}
  4. ]
  5. end

Chunky documentation can be found on Hexdocs at https://hexdocs.pm/chunky.

Documentation