elixir-range-extras alternatives and similar packages
Based on the "Text and Numbers" category.
Alternatively, view elixir-range-extras alternatives based on common mentions on social networks and blogs.
-
money
Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog. -
slime
Minimalistic HTML templates for Elixir, inspired by Slim. -
nanoid
Elixir port of NanoID, a secure and URL-friendly unique ID generator. https://hex.pm/packages/nanoid -
stemmer
An English (Porter2) stemming implementation in Elixir. -
exmoji
:sunglasses: Emoji encoding swiss army knife for Elixir/Erlang -
secure_random
Convenience library for random base64 strings modeled after my love for Ruby's SecureRandom -
chinese_translation
An elixir module to translate simplified Chinese to traditional Chinese, and vice versa, based on wikipedia data -
veritaserum
Sentiment analysis based on afinn-165, emojis and some enhancements. -
abacus
Parses and evaluates mathematical expressions in Elixir. Inspired by math.js -
brcpfcnpj
Validação,Formatação e Gerador Cpf/Cnpj em Elixir -
neotomex
A PEG parser/transformer with a pleasant Elixir DSL. -
monetized
A lightweight solution for handling and storing money. -
Ex_Cldr_Numbers
CLDR Number localisation and formatting -
inet_cidr
CIDR library for Elixir that is compatible with Erlang's :inet and supports both IPv4 and IPv6 -
sentient
Simple sentiment analysis using the AFINN-111 word list -
haikunator
Generate Heroku-like memorable random names to use in your apps or anywhere else. -
Ex_Cldr_Units
Unit formatting (volume, area, length, ...) functions for the Common Locale Data Repository (CLDR) -
expr
An Elixir library for parsing and evaluating mathematical expressions -
mt940
MT940 (standard structured SWIFT Customer Statement message) parser for Elixir. -
custom_base
Allow you to make custom base conversion in Elixir. -
convertat
An Elixir library for converting from and to arbitrary bases.
ONLYOFFICE Docs — document collaboration in your environment
Do you think we are missing an alternative of elixir-range-extras or a related project?
README
RangeExtras
Elixir range utilities: constant-time random sampling and set operations.
Installation
First, please make sure that you’re running Erlang/OTP 18.0 or newer.
Add range_extras
to your list of dependencies in mix.exs
:
def deps do
[{:range_extras, "~> 0.1.0"}]
end
Run mix deps.get
.
Read the latest documentation at https://hexdocs.pm/range_extras/.
Set operations
union/2
difference/2
intersection/2
These functions take two ranges and return a list of zero to two ranges:
iex> RangeExtras.union(1..4, 3..5)
[1..5]
iex> RangeExtras.difference(8..1, 4..4)
[8..5, 3..1]
iex> RangeExtras.intersection(8..1, -4..0)
[]
They’re implemented as simple cond
clauses that match on the start and end
values of the ranges, so they run in constant time.
Ranges are always inclusive.
The direction of the resulting ranges is the same as the direction of the first given range:
iex> RangeExtras.union(1..4, 3..5)
[1..5]
iex> RangeExtras.union(4..1, 3..5)
[5..1]
Random sampling
random/1
Works in the same way as Enum.random/1
, but runs in constant time as well
since it only uses the start and end values of the range.
The implementation uses Erlang’s :rand
module. You don’t need to seed the
generator like you have to currently do with Enum.random/1
that uses
:random
instead.
(The development version of Elixir now uses :rand
.)
Licence
ISC License (ISC)
Copyright © 2015 Leo Nikkilä
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*Note that all licence references and agreements mentioned in the elixir-range-extras README section above
are relevant to that project's source code only.