patience 0.1 → 0.1.1
raw patch · 2 files changed
+16/−4 lines, 2 filesdep ~containers
Dependency ranges changed: containers
Files
- Data/Algorithm/Patience.hs +11/−2
- patience.cabal +5/−2
Data/Algorithm/Patience.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DeriveDataTypeable- , ViewPatterns #-}+ , ViewPatterns+ , CPP #-} -- | Implements \"patience diff\" and the patience algorithm for the longest -- increasing subsequence problem. module Data.Algorithm.Patience@@ -93,9 +94,17 @@ (ysr, S.viewl -> (y :< yse)) = S.splitAt ny ys in Diff xse yse : Match x y : chop xsr ysr ns +-- Zip a list with a Seq.+zipLS :: [a] -> S.Seq b -> S.Seq (a, b)+#if MIN_VERSION_containers(0,3,0)+zipLS = S.zip . S.fromList+#else+zipLS xs = S.fromList . zip xs . F.toList+#endif+ -- Number the elements of a Seq. number :: S.Seq t -> S.Seq (Int,t)-number xs = S.zip (S.fromList [0..S.length xs - 1]) xs+number xs = zipLS [0..S.length xs - 1] xs -- | An element of a computed difference. data Item t
patience.cabal view
@@ -1,5 +1,5 @@ name: patience-version: 0.1+version: 0.1.1 license: BSD3 license-file: LICENSE synopsis: Patience diff and longest increasing subsequence@@ -17,6 +17,9 @@ performance, nice output for humans, and implementation simplicity. For more information, see <http://alfedenzo.livejournal.com/170301.html> and <http://bramcohen.livejournal.com/73318.html>.+ .+ New in version 0.1.1: relaxed @containers@ dependency, so it should build on+ GHC 6.10. extra-source-files: test/test.hs@@ -26,4 +29,4 @@ ghc-options: -Wall build-depends: base >= 3 && < 5- , containers >= 0.3+ , containers >= 0.2