[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 15:04:35 UTC 2010


The following commit has been merged in the master branch:
commit 189ae08139d049d04e46fde7d2521b0d9431c3a7
Author: John Goerzen <jgoerzen at complete.org>
Date:   Tue Dec 27 00:23:15 2005 +0100

    List optimizations from Bulat Ziganshin

diff --git a/MissingH/List.hs b/MissingH/List.hs
index f5a9778..94b809c 100644
--- a/MissingH/List.hs
+++ b/MissingH/List.hs
@@ -268,7 +268,7 @@ strToAL inp =
 {- | Returns a count of the number of times the given element occured in the
 given list. -}
 countElem :: Eq a => a -> [a] -> Int
-countElem i l = length (elemIndices i l)
+countElem i = length . filter (i==)
 
 {- | Returns the rightmost index of the given element in the
 given list. -}
@@ -288,7 +288,7 @@ alwaysElemRIndex item list =
 {- | Forces the evaluation of the entire list. -}
 seqList :: [a] -> [a]
 seqList [] = []
-seqList (x:xs) = seq (seqList xs) (x:xs)
+seqList list@(x:xs) = seq (seqList xs) list
 
 --------------------------------------------------
 -- Advanced Conversions

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list