JuliaMath / JuliaMath/IntervalSets.jl

Iterate over interval boundaries

Open
#218 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
109
Forks
29
PR merge metrics
No merged PRs in 30d

Description

I think it would make sense to support the iteration interface for `Interval` to return the `left` and `right` boundaries. This would allow more compact destructuring, as in
```julia
lo, hi = 2 .. 4
```
This is nice for example when you have a method which accepts an `Interval`, but really only works with the boundaries. Then you can direct destruct it in the method signature without using property destructuring. The latter one is more verbose and potentially uses private API (not sure whether the field names are considered public API)

The iteration would deliberately not return elements inside the interval. First of all, because we are talking about intervals of a continuous set in general, and secondly, because that's what `Range`s are for.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the existing iteration behavior for `Interval` and the package's related tests. Add coverage for destructuring `lo, hi = 2 .. 4`, ensuring iteration yields the `left` and `right` boundaries rather than values inside the interval. Done means boundary destructuring works while preserving the interval's continuous-set semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.