forked from exercism/futhark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.fut
More file actions
55 lines (45 loc) · 1.16 KB
/
test.fut
File metadata and controls
55 lines (45 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import "matrix"
-- extract row from one number matrix
-- ==
-- entry: test_row
-- input { "1" 1 }
-- output { [1] }
-- can extract row
-- ==
-- entry: test_row
-- input { "1 2\n3 4" 2 }
-- output { [3, 4] }
-- extract row where numbers have different widths
-- ==
-- entry: test_row
-- input { "1 2\n10 20" 2 }
-- output { [10, 20] }
-- can extract row from non-square matrix with no corresponding column
-- ==
-- entry: test_row
-- input { "1 2 3\n4 5 6\n7 8 9\n8 7 6" 4 }
-- output { [8, 7, 6] }
-- extract column from one number matrix
-- ==
-- entry: test_column
-- input { "1" 1 }
-- output { [1] }
-- can extract column
-- ==
-- entry: test_column
-- input { "1 2 3\n4 5 6\n7 8 9" 3 }
-- output { [3, 6, 9] }
-- can extract column from non-square matrix with no corresponding row
-- ==
-- entry: test_column
-- input { "1 2 3 4\n5 6 7 8\n9 8 7 6" 4 }
-- output { [4, 8, 6] }
-- extract column where numbers have different widths
-- ==
-- entry: test_column
-- input { "89 1903 3\n18 3 1\n9 4 800" 2 }
-- output { [1903, 3, 4] }
entry test_row (string: []u8) (index: i32): []i32 =
row string index
entry test_column (string: []u8) (index: i32): []i32 =
column string index