# Is there a built-in function for the natural length of a segment represented by an iterator?

**URL:** <https://discourse.julialang.org/t/is-there-a-built-in-function-for-the-natural-length-of-a-segment-represented-by-an-iterator/112414>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [April 2, 2024, 11:44am UTC](https://discourse.julialang.org/t/is-there-a-built-in-function-for-the-natural-length-of-a-segment-represented-by-an-iterator/112414 "2024-04-02T11:44:40Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Post date:** [April 2, 2024, 6:26pm UTC](https://discourse.julialang.org/t/is-there-a-built-in-function-for-the-natural-length-of-a-segment-represented-by-an-iterator/112414/9 "2024-04-02T18:26:46Z")

</div>

Some variations of the same idea

`diamet(itr) = -(-(extrema(itr)...))`

```julia
diameter(itr) = [-1 1]*[extrema(itr)...]

```

---

_[View the full topic](https://discourse.julialang.org/t/is-there-a-built-in-function-for-the-natural-length-of-a-segment-represented-by-an-iterator/112414)._
