# Sort Module

**URL:** <https://chapel.discourse.group/t/sort-module/3478>\
**Category:** Users\
**Created:** [February 14, 2021, 7:32am UTC](https://chapel.discourse.group/t/sort-module/3478 "2021-02-14T07:32:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![damianmoz](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/damianmoz/32/319_2.png) [@damianmoz](https://chapel.discourse.group/u/damianmoz)\
**Post date:** [February 14, 2021, 7:32am UTC](https://chapel.discourse.group/t/sort-module/3478/1 "2021-02-14T07:32:47Z")

</div>

Where is this documented in 1.23 please? I have found it for 1.12. Is this  
just a Work in Progress?

Also, why have a Search package which is not general enough to be able to  
be re-used within the Sort package? Just curious.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037  
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here  
Views & opinions here are mine and not those of any past or present employer

---

<div class="post-metadata">

**Author:** ![vass](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/vass/32/692_2.png) [@vass](https://chapel.discourse.group/u/vass)\
**Post date:** [February 15, 2021, 3:11am UTC](https://chapel.discourse.group/t/sort-module/3478/2 "2021-02-15T03:11:09Z")

</div>

Hi Damian,

The documentation for the Sort module for the latest release is going to be here:

[https://chapel-lang.org/docs/modules/packages/Sort.html](https://chapel-lang.org/docs/modules/packages/Sort.html)

Not sure about the Search module. How would you expect it to be reused for Sort?

Vass

---

<div class="post-metadata">

**Author:** ![damianmoz](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/damianmoz/32/319_2.png) [@damianmoz](https://chapel.discourse.group/u/damianmoz)\
**Post date:** [February 15, 2021, 8:11am UTC](https://chapel.discourse.group/t/sort-module/3478/3 "2021-02-15T08:11:11Z")

</div>

Hi Vass,

> [Sort — Chapel Documentation 1.32](https://chapel-lang.org/docs/modules/packages/Sort.html)

The current one does not document all the modules, such as Insertion Sort,  
Tim Sort, Bubble Sort, Heap Sort, Merge Sort, Shell Sort, Quick Sort, and  
others.

> Not sure about the Search module. How would you expect it to be reused  
> for Sort?

There are Binary Search routines in the Sort Module which are different to  
those in the Search module so you loose the benefits of reusability.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037  
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here  
Views & opinions here are mine and not those of any past or present employer

---

<div class="post-metadata">

**Author:** ![mppf](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mppf](https://chapel.discourse.group/u/mppf)\
**Post date:** [February 16, 2021, 1:54pm UTC](https://chapel.discourse.group/t/sort-module/3478/4 "2021-02-16T13:54:00Z")

</div>

Hi Damian -

Yes, things like Bubble Sort and Shell Sort are intentionally undocumented in the Sort module.

The expectation is that at some point the Sort module will become a standard module. I don't think it makes sense for that main standard module to have a gazillion Sort algorithms in it (it should focus on having a small, stable, and functional API).

However we can keep the gazillion Sort algorithms as package modules indefinitely. The package module does not have the same level of strictness in terms of API stability. For example, we might move these into a package module called SortAlgorithms or something like that.

I don't have an intelligent answer to the issue you brought up with two versions of binary search - that seems like something we should resolve at some point.

Thanks,

-michael

---

<div class="post-metadata">

**Author:** ![damianmoz](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/damianmoz/32/319_2.png) [@damianmoz](https://chapel.discourse.group/u/damianmoz)\
**Post date:** [February 25, 2021, 6:21am UTC](https://chapel.discourse.group/t/sort-module/3478/5 "2021-02-25T06:21:56Z")

</div>

Thanks for the clear explanation.

The issues with multiple versions of binary search can wait. It is not urgent. I just noticed it while I was cleaning up my version of TimSort. When I find a spare day or so, I will merge my modifications into the  
version in Sort.chpl. Don't hold your breath.
