[Haskell-cafe] list utilities -- shouldn't these be in the hierarchical libs somewhere?

Twan van Laarhoven twanvl at gmail.com
Tue Dec 18 11:13:39 EST 2007


Jules Bean wrote:

> Thomas Hartman wrote:
> 
>>
>> I found
>>
>>   http://haskell.cs.yale.edu/haskell-report/List.html
>>
>>   had many useful "one off" type list functions such as "subsequences" 
>> and "permutations" which are nowhere to be found in hoogle, Data.List, 
>> or the haskell hierarchical libs
> 
> 
> Weird.
> 
> It's not very many. Other that those, I spotted: sums, products, 
> elemIndexBy, elemBy.
> 
> I have no idea why they were removed between that version of the report 
> and haskell98.

For the ones you mention:

  - sums, products:

       The names don't make it clear what they do, I could for instance 
imagine sums being 'map sum'. And should it be a 'scanl' or 'scanr'?

  - elemIndexBy, elemBy:

       elemBy f x = any (f x)
       elemIndexBy f xs x = findIndex (f x) xs

On the other hand, I would love to see "subsequences" and "permutations" 
added to Data.List. In fact, I made a library proposal to make this 
happen, hopefully they will be added to the standard library soon.

Twan


More information about the Haskell-Cafe mailing list