Hi,

the following program produces a space leak:

>module Main where

>import List

>bruteForce :: Eq a => [a] -> [a] -> [Int]
>bruteForce pattern = findIndices (\b -> b) 
>                   . map (isPrefixOf pattern) 
>                   . tails

>main = do
>        text <- getContents  
>        putStr $ show 
>               $ bruteForce "pattern" text

For example searching for a pattern in a 5M Text needs >20M heap.

-- 
Yousry Abdallah
[EMAIL PROTECTED]

Reply via email to