<div>Hello dear Haskellers!</div><div><br></div><div>I've been a user and big fan of Haskell for a while, but only now I'm writing my first "big" project in Haskell (some thousands of lines of code perhaps). It's an interpreter for a programming language, the source code is music! Yes, sheet music! :D</div>
<div><br></div><div>OK, so my specific problem goes like this: I have a list of tuples</div><div><font class="Apple-style-span" face="'courier new', monospace">:t myList</font></div><div><font class="Apple-style-span" face="'courier new', monospace">[ (Float, Integer) ]</font></div>
<div><br></div><div>And I want to "group" this list into a nested list</div><div><font class="Apple-style-span" face="'courier new', monospace">groupAtoms :: [ (Float,Integer) ] -> [ [(Float,Integer)] ]</font></div>
<div><br></div><div>Of course, I want that the concatenation of the groups yield me the original list, i.e, (foldl (++) [] . groupAtoms == id), and the criterion that defines a group is that:</div><div>"The sum of the first elements in the tuples comprising the list must be greater than or equal to 1.0". That is, given a list of tuples, the boolean predicate deciding whether this list is a PROPER group (True) or TOO SMALL (False) is:</div>
<div><font class="Apple-style-span" face="'courier new', monospace">\g -> sum (map fst g) >= 1.0</font></div><div><br></div><div><br></div><div>Although the criterion is very clear, I've tried hard until now and couldn't come up with a function for producing the nested list based on this grouping criterion. I am sure that the Haskell Hierarchical Libraries have something</div>
<div>to help me, but only now I see I'm still a big noob :P</div><div><br></div><div>Could someone please help me writing this function?</div><div><br></div><div><br></div><div>My best regards from Brazil,</div><div>
<br>
</div>João Paulo Pizani Flor<div><a href="mailto:joaopizani@gmail.com" target="_blank">joaopizani@gmail.com</a></div><div>Federal University of Santa Catarina</div><br>