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
59 lines (47 loc) · 1.75 KB
/
test.fut
File metadata and controls
59 lines (47 loc) · 1.75 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
56
57
58
59
import "transpose"
-- two characters in a row
-- ==
-- input { ["A1"] }
-- output { ["A", "1"] }
-- two characters in a column
-- ==
-- input { ["A", "1"] }
-- output { ["A1"] }
-- simple
-- ==
-- input { ["ABC", "123"] }
-- output { ["A1", "B2", "C3"] }
-- single line
-- ==
-- input { ["Single line."] }
-- output { ["S", "i", "n", "g", "l", "e", " ", "l", "i", "n", "e", "."] }
-- first line longer than second line
-- ==
-- input { ["The fourth line.", "The fifth line. "] }
-- output { ["TT", "hh", "ee", " ", "ff", "oi", "uf", "rt", "th", "h ", " l", "li", "in", "ne", "e.", ". "] }
-- second line longer than first line
-- ==
-- input { ["The first line. ", "The second line."] }
-- output { ["TT", "hh", "ee", " ", "fs", "ie", "rc", "so", "tn", " d", "l ", "il", "ni", "en", ".e", " ."] }
-- mixed line length
-- ==
-- input { ["The longest line.", "A long line. ", "A longer line. ", "A line. "] }
-- output { ["TAAA", "h ", "elll", " ooi", "lnnn", "ogge", "n e.", "glr ", "ei ", "snl ", "tei ", " .n ", "l e ", "i . ", "n ", "e ", ". "] }
-- square
-- ==
-- input { ["HEART", "EMBER", "ABUSE", "RESIN", "TREND"] }
-- output { ["HEART", "EMBER", "ABUSE", "RESIN", "TREND"] }
-- rectangle
-- ==
-- input { ["FRACTURE", "OUTLINED", "BLOOMING", "SEPTETTE"] }
-- output { ["FOBS", "RULE", "ATOP", "CLOT", "TIME", "UNIT", "RENT", "EDGE"] }
-- triangle
-- ==
-- input { ["T ", "EE ", "AAA ", "SSSS ", "EEEEE ", "RRRRRR"] }
-- output { ["TEASER", " EASER", " ASER", " SER", " ER", " R"] }
-- jagged triangle
-- ==
-- input { ["11 ", "2 ", "3333 ", "444 ", "555555", "66666 "] }
-- output { ["123456", "1 3456", " 3456", " 3 56", " 56", " 5 "] }
def main [m] [n] (lines: [m][n]u8): [n][m]u8 =
transposition lines