#3671: Add partitioning functions to Data.List
-----------------------------+----------------------------------------------
Reporter: holzensp | Owner:
Type: proposal | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.12.1 RC1
Resolution: | Keywords: Data.List
Difficulty: | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: None/Unknown |
-----------------------------+----------------------------------------------
Changes (by [email protected]):
* difficulty: =>
Comment:
Although your recursive 'takeRec' makes some sense, the recursive
'spanRec' is more dubious.
{{{
spanRec p xs = let (hs,ts) = span p xs in hs : spanRec p ts
}}}
By the definition of 'span', the first element of 'ts' satisfies the
predicate p. Thus, in the first recursive call, 'span' will split the
remaining list into [] and ts, the second recursive call likewise, and so
on ad infinitum.
{{{
spanRec (==0) [1,2,3,0,4,5,6] = [1,2,3]:[]:[]:[]:[]...
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3671#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs