acalejos
I was finding myself needing a library to check for real-valued interval memberships. This was from writing libraries whose parameters must adhere to these restrictions, such as regularization terms or learning rates.
The API is simple for interval creation and supports the Enumerable protocol when a interval step is defined.
Here’s a sample of the API:
iex> import Exterval
iex> ~I<[1, 10)//2>
[1, 10)//2
iex> ~I<[1, 10)//2> |> Enum.to_list()
[1.0, 3.0, 5.0, 7.0, 9.0]
iex> ~I<[1, 10)//2> |> Enum.reduce(&+/2)
25.0
iex> ~I<[-1, 3)//-0.5> |> Enum.to_list()
[2.5, 2.0, 1.5, 1.0, 0.5, 0.0, -0.5, -1.0
iex> ~I<[1, 10]> |> Enum.count()
:infinity
iex> ~I<[1, 10)//2> |> Enum.count()
4
iex> ~I<[-2,-2]//1.0> |> Enum.count()
1
iex> ~I<[1,2]//0.5> |> Enum.count()
3
iex> ~I<[-2,-1]//0.75> |> Enum.count()
2
iex> 1 in ~I<[1, 10]>
true
iex> 1 in ~I<[1, 10)//2>
true
iex> 3 in ~I<(1, 10)//2>
true
Feedback is much appreciated ![]()
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
I released Doggo, a collection of unstyled Phoenix components.
https://github.com/woylie/doggo
Features
Unstyled Phoenix components....
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
I’ve started working on a new library to run SQL queries and do basic business intelligence.
Think “Blazer for Elixir.”
Currently it fe...
New
Other Trending Topics
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
:microphone: ElixirConf 2026 - Call for Talks is open!
We’re heading to Chicago :united_states:
:round_pushpin: In person + virtual
:d...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
acalejos
Finally found time to do a quick write-up about this library and sigils in general: Elevate Your Elixir With Sigils
Also pushed some updates in the form of a v0.2.0 release to allow for string interpolation within the interval creation.
This required changing from
~Ito~isince only lowercase sigils allow for string interpolation. But now you can declare intervals as so:Currently using this tiny 1-file library to support parameter validation in two of my other libraries and love the simplicity of it so far.