You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+2-33Lines changed: 2 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,40 +21,9 @@ libraries
21
21
22
22
[vector](http://www.datahaskell.org/docs/library/vector.html) is an efficient implementation of Int-indexed arrays (both mutable and immutable), with a powerful loop optimisation framework.
23
23
24
+
[hmatrix](http://www.datahaskell.org/docs/library/hmatrix.html) is a linear algebra and matrix library, using the Data.Vector.Storable instance in the vector package under the hood.
24
25
25
26
examples
26
27
---
27
28
28
-
```{.sourceCode .literate .haskell}
29
-
import Protolude
30
-
import Data.Vector as V
31
-
32
-
main :: IO ()
33
-
main = do
34
-
-- vector examples
35
-
let x = V.fromList [0..5]
36
-
37
-
print $ V.length x -- 6
38
-
print $ V.null x -- False
39
-
40
-
-- indexing
41
-
print $ x ! 1 -- 1
42
-
print $ V.head x -- 0
43
-
print $ last x -- 5
44
-
45
-
-- Slicing
46
-
print $ slice 2 3 x -- [2, 3, 4]
47
-
print $ V.splitAt 2 x -- ([0, 1], [2, 3, 4, 5])
48
-
49
-
-- Prepending and Appending
50
-
print $ cons (-1) x -- [-1, 0, 1, 2, 3, 4, 5]
51
-
print $ snoc x 6 -- [0, 1, 2, 3, 4, 5, 6]
52
-
53
-
-- Concatenation
54
-
print $ x V.++ x -- [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]
0 commit comments