# Compress a list that contains segments of continuous numbers to a list which contains list of range of segments \[start,end\]

**URL:** <https://swi-prolog.discourse.group/t/compress-a-list-that-contains-segments-of-continuous-numbers-to-a-list-which-contains-list-of-range-of-segments-start-end/7421>\
**Category:** Help!\
**Tags:** how-to\
**Created:** [April 29, 2024, 11:35am UTC](https://swi-prolog.discourse.group/t/compress-a-list-that-contains-segments-of-continuous-numbers-to-a-list-which-contains-list-of-range-of-segments-start-end/7421 "2024-04-29T11:35:38Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![brebs](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@brebs](https://swi-prolog.discourse.group/u/brebs)\
**Post date:** [April 29, 2024, 8:56pm UTC](https://swi-prolog.discourse.group/t/compress-a-list-that-contains-segments-of-continuous-numbers-to-a-list-which-contains-list-of-range-of-segments-start-end/7421/20 "2024-04-29T20:56:01Z")

</div>

I’ve posted an alternative method: [Prolog: Compress a list that contains segments of continuous numbers to a list which contains list of range of segments [start,end] - Stack Overflow](https://stackoverflow.com/a/78405105/17628336)

… which uses [Push-back lists on DCG rule heads](https://swi-prolog.discourse.group/t/push-back-lists-on-dcg-rule-heads/6532)

---

_[View the full topic](https://swi-prolog.discourse.group/t/compress-a-list-that-contains-segments-of-continuous-numbers-to-a-list-which-contains-list-of-range-of-segments-start-end/7421)._
