diff options
author | Alberto Ruiz <aruiz@um.es> | 2010-01-20 12:05:34 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2010-01-20 12:05:34 +0000 |
commit | 408997ea02dec897934b176fe57115bdb4f60f63 (patch) | |
tree | 3a9a4a86328ec36d5c6ad31eb8e6609cfb7a05ea /lib/Data/Packed/Internal/Common.hs | |
parent | 102d6b19beadd76b28d32e1aa40844fad19af756 (diff) |
more defined fromRows/fromColumns/fromBlocks
Diffstat (limited to 'lib/Data/Packed/Internal/Common.hs')
-rw-r--r-- | lib/Data/Packed/Internal/Common.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Common.hs b/lib/Data/Packed/Internal/Common.hs index 629016d..972cd7d 100644 --- a/lib/Data/Packed/Internal/Common.hs +++ b/lib/Data/Packed/Internal/Common.hs | |||
@@ -18,7 +18,7 @@ module Data.Packed.Internal.Common( | |||
18 | Adapt, | 18 | Adapt, |
19 | app1, app2, app3, app4, | 19 | app1, app2, app3, app4, |
20 | (//), check, | 20 | (//), check, |
21 | partit, common, | 21 | partit, common, compatdim, |
22 | fi | 22 | fi |
23 | ) where | 23 | ) where |
24 | 24 | ||
@@ -41,6 +41,12 @@ common f = commonval . map f where | |||
41 | commonval [a] = Just a | 41 | commonval [a] = Just a |
42 | commonval (a:b:xs) = if a==b then commonval (b:xs) else Nothing | 42 | commonval (a:b:xs) = if a==b then commonval (b:xs) else Nothing |
43 | 43 | ||
44 | -- | common value with \"adaptable\" 1 | ||
45 | compatdim :: [Int] -> Maybe Int | ||
46 | compatdim [] = Nothing | ||
47 | compatdim [a] = Just a | ||
48 | compatdim (a:b:xs) = if a==b || a==1 || b==1 then compatdim (max a b:xs) else Nothing | ||
49 | |||
44 | -- | postfix function application (@flip ($)@) | 50 | -- | postfix function application (@flip ($)@) |
45 | (//) :: x -> (x -> y) -> y | 51 | (//) :: x -> (x -> y) -> y |
46 | infixl 0 // | 52 | infixl 0 // |