Skip to content

Commit f573479

Browse files
committed
str
1 parent 1f7f152 commit f573479

8 files changed

Lines changed: 24 additions & 23 deletions

File tree

47.8 KB
Binary file not shown.
60.8 KB
Binary file not shown.
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
app [main] {
22
pf: platform "../../../platforms/go/main.roc"
33
}
4-
import Lib.Display exposing [str]
4+
import Lib.Display exposing [str, matrix]
55
main : Str
6-
main = str [
7-
["Roc", "<3", "Go", "!", "!", "!"],
8-
["This", "is", "a", "Roc", "application", "running", "on", "Go."],
9-
["It", "imports", "a", "Roc", "module", "and", "calls", "a", "function", "from", "it."],
10-
]
11-
#matrix 2 3
12-
#[
13-
# ["Roc", "<3", "Go", "!", "!", "!"],
14-
# ["This", "is", "a", "Roc", "application", "running", "on", "Go."],
15-
# ["It", "imports", "a", "Roc", "module", "and", "calls", "a", "function", "from", "it."],
16-
#]
6+
main = str (matrix [261, 23])
0 Bytes
Binary file not shown.

pkgs/roc/lib/Display.roc

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
module [str]
2-
#module [str, matrix]
1+
module [str, matrix]
32
str : List (List Str) -> Str
43
str = |lines| lines
5-
|> List.map (\ws -> Str.join_with(ws, " "))
4+
|> List.map (\ws -> Str.join_with(ws, "\t"))
65
|> Str.join_with("\n")
7-
#matrix : Int -> Int -> List (List Str)
8-
#matrix rows cols =
9-
# List.range 0 rows
10-
# |> List.map (\r ->
11-
# List.range 0 cols
12-
# |> List.map (\c -> Num.to_str (r * cols + c))
13-
# )
6+
matrix : List I128 -> List (List Str)
7+
matrix = |list|
8+
List.range { start: At 0, end: At (Result.with_default(List.get(list, 0), 10) - 1) }
9+
|> List.map (\r ->
10+
List.range { start: At 0, end: At (Result.with_default(List.get(list, 1), 10) - 1) }
11+
|> List.map (\c ->
12+
Str.join_with [
13+
Str.repeat "0" (
14+
Str.count_utf8_bytes((Num.to_str (
15+
(Result.with_default(List.get(list, 0), 10) *
16+
Result.with_default(List.get(list, 1), 10)) - 1
17+
))) -
18+
Str.count_utf8_bytes((Num.to_str (
19+
r * Result.with_default(List.get(list, 1), 10) + c
20+
)))
21+
),
22+
Num.to_str (r * Result.with_default(List.get(list, 1), 10) + c)
23+
] ""
24+
)
25+
)

pkgs/roc/platforms/go/dynhost

0 Bytes
Binary file not shown.

pkgs/roc/platforms/go/linux-x64.rh

0 Bytes
Binary file not shown.

pkgs/roc/scripts/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ while true; do
3434
--help) usage ;;
3535
--)
3636
shift
37-
break
3837
;;
3938
# *) usage ;;
4039
*)

0 commit comments

Comments
 (0)