diff options
Diffstat (limited to 'examples/experiments/listlike.hs')
-rw-r--r-- | examples/experiments/listlike.hs | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/examples/experiments/listlike.hs b/examples/experiments/listlike.hs deleted file mode 100644 index 2d62447..0000000 --- a/examples/experiments/listlike.hs +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | {-# OPTIONS_GHC -fglasgow-exts #-} | ||
2 | |||
3 | import qualified Data.ListLike as LL | ||
4 | import Numeric.LinearAlgebra | ||
5 | import Data.Monoid | ||
6 | import Foreign | ||
7 | |||
8 | instance Storable a => LL.FoldableLL (Vector a) a where | ||
9 | foldl f x v = foldl f x (toList v) | ||
10 | foldr f x v = foldr f x (toList v) | ||
11 | |||
12 | instance Storable a => LL.ListLike (Vector a) a where | ||
13 | singleton a = fromList [a] | ||
14 | head a = a @> 0 | ||
15 | tail a | dim a == 1 = mempty | ||
16 | | otherwise = subVector 1 (dim a -1) a | ||
17 | genericLength = fromIntegral.dim | ||
18 | |||
19 | |||
20 | v k = fromList [1..k] :: Vector Double | ||
21 | |||
22 | f k = k+(3::Double) | ||
23 | |||
24 | main = print $ (LL.map f [1..5] :: Vector Double) \ No newline at end of file | ||