{"id":16499449,"url":"https://github.com/tpapp/discreteranges.jl","last_synced_at":"2026-03-03T21:31:18.471Z","repository":{"id":55588564,"uuid":"107850327","full_name":"tpapp/DiscreteRanges.jl","owner":"tpapp","description":"Representation and basic operations for ranges of types isomorphic to integers.","archived":false,"fork":false,"pushed_at":"2020-12-20T09:14:24.000Z","size":19,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-20T20:04:45.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-22T08:45:21.000Z","updated_at":"2020-02-08T15:26:59.000Z","dependencies_parsed_at":"2022-08-15T03:50:21.177Z","dependency_job_id":null,"html_url":"https://github.com/tpapp/DiscreteRanges.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tpapp/DiscreteRanges.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FDiscreteRanges.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FDiscreteRanges.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FDiscreteRanges.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FDiscreteRanges.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpapp","download_url":"https://codeload.github.com/tpapp/DiscreteRanges.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpapp%2FDiscreteRanges.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30062350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T14:52:57.209Z","updated_at":"2026-03-03T21:31:18.434Z","avatar_url":"https://github.com/tpapp.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DiscreteRanges\n\n![Lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)\n[![Build Status](https://travis-ci.org/tpapp/DiscreteRanges.jl.svg?branch=master)](https://travis-ci.org/tpapp/DiscreteRanges.jl)\n[![Coverage Status](https://coveralls.io/repos/github/tpapp/DiscreteRanges.jl/badge.svg?branch=master)](https://coveralls.io/github/tpapp/DiscreteRanges.jl?branch=master)\n[![codecov.io](http://codecov.io/github/tpapp/DiscreteRanges.jl/coverage.svg?branch=master)](http://codecov.io/github/tpapp/DiscreteRanges.jl?branch=master)\n\n## Introduction\n\nThis package provides a type `DiscreteRange{T}` for types `T` which\nare isomorphic to integers, in the sense that elements of `T` can be\nthought of as evenly spaced values using some relevant arithmetic\noperations. All subtypes of `Integer` satisfy this, and also `Date`.\n\n`DiscreteRange(left::T, right::T)` is meant to represent all values\n`x::T` such that `a ≤ x ≤ b`. In this sense it is very similar to a\n`UnitRange`, except that it can be defined for types other than `\u003c:\nReal`, and extended easily (see below). Iteration, indexing and array\ninterfaces are supported, and so are basic set operations (`∪`, `∩`,\n`⊆`, `∈`, etc).\n\n## Comparison and conflict with `IntervalSets.jl`\n\n[`IntervalSets.jl`](https://github.com/JuliaMath/IntervalSets.jl) is a similar library serving a different purpose. Both export `..`, you can avoid conflicts by importing only `DiscreteRange` and optionally using another infix operator:\n\n```julia\nusing DiscreteRanges: DiscreteRange\nconst ∷ = DiscreteRanges.:(..) # or pick your favorite operator\n1∷2                            # DiscreteRange{Int}(1, 2)\n```\n\nThen comparing the two packages, keep in mind that `IntervalSets.jl`\nis better for representing intervals of *real numbers*, while a\n`DiscreteRange` is a collection of a finite number of objects.\n\nThe following table summarizes the differences:\n\n|   | `DiscreteRange` | `IntervalSets.ClosedInterval` |\n|---|---|---|\n| `3 ∈ 1..3` | `true` | `true` |\n| `3.0 ∈ 1..3` | `true` (converted first) | `true` (compared as is) |\n| `3.1 ∈ 1..3` | throws `InexactError` | `true` |\n| `1.0..3.0` | throws `ArgumentError` (non-discrete type) | valid |\n| `(1..2) ∪ (3..4)` | `1..4` | throws `ArgumentError` (disjoint) |\n| `length(1..3)` | `3` | `3` **(this may change)** |\n| `width(1..3)` | throws `MethorError` | `2` |\n| `(1..2) ∈ (0..10)` | throws `MethorError` | `true` |\n\n## Extending for custom types\n\nTo make `DiscreteRange` work for a type `T`, define `isdiscrete`,\n`discrete_gap`, and `discrete_next`. See their docstring for further\ninformation. There is an example in the unit tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpapp%2Fdiscreteranges.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpapp%2Fdiscreteranges.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpapp%2Fdiscreteranges.jl/lists"}