Skip to content

Commit 9ca5815

Browse files
committed
final syntax updates
1 parent fe75df8 commit 9ca5815

6 files changed

Lines changed: 30 additions & 25 deletions

File tree

exercises/practice/complex-numbers/.meta/plugins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
float_map = {
22
"e": "Num.e",
3-
"ln(2)": "Num.log 2f64",
4-
"ln(2)/2": "Num.log 2f64 / 2",
3+
"ln(2)": "Num.log(2f64)",
4+
"ln(2)/2": "Num.log(2f64) / 2",
55
"pi": "Num.pi",
66
"pi/4": "Num.pi / 4",
77
}

exercises/practice/complex-numbers/complex-numbers-test.roc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,14 @@ expect
257257

258258
# Exponential of a number with real and imaginary part
259259
expect
260-
z = { re: Num.log 2f64, im: Num.pi }
260+
z = { re: Num.log(2f64), im: Num.pi }
261261
result = exp(z)
262262
expected = { re: -2, im: 0 }
263263
result |> is_approx_eq(expected)
264264

265265
# Exponential resulting in a number with real and imaginary part
266266
expect
267-
z = { re: Num.log 2f64 / 2, im: Num.pi / 4 }
267+
z = { re: Num.log(2f64) / 2, im: Num.pi / 4 }
268268
result = exp(z)
269269
expected = { re: 1, im: 1 }
270270
result |> is_approx_eq(expected)

exercises/practice/go-counting/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
{% macro to_territory(territory) %}
66
{%- if territory == [] %}
7-
Set.empty {}
7+
Set.empty({})
88
{%- else %}
99
Set.from_list([
1010
{%- for intersection in territory %}

exercises/practice/go-counting/go-counting-test.roc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ expect
117117
expected = Ok(
118118
{
119119
owner: None,
120-
territory: Set.empty {},
120+
territory: Set.empty({}),
121121
},
122122
)
123123
result |> compare_territory(expected)
@@ -156,9 +156,9 @@ expect
156156
result = board |> territories
157157
expected = Ok(
158158
{
159-
black: Set.empty {},
159+
black: Set.empty({}),
160160

161-
white: Set.empty {},
161+
white: Set.empty({}),
162162

163163
none: Set.from_list(
164164
[
@@ -194,7 +194,7 @@ expect
194194
],
195195
),
196196

197-
none: Set.empty {},
197+
none: Set.empty({}),
198198
},
199199
)
200200
result |> compare_territories(expected)
@@ -212,9 +212,9 @@ expect
212212
],
213213
),
214214

215-
white: Set.empty {},
215+
white: Set.empty({}),
216216

217-
none: Set.empty {},
217+
none: Set.empty({}),
218218
},
219219
)
220220
result |> compare_territories(expected)

exercises/practice/rest-api/.meta/template.j2

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
import {{ exercise | to_pascal }} exposing [get, post]
66

77
standardize_result = |result|
8-
result |> Result.try |string|
9-
string
10-
|> Str.replace_each(".0,", ",")
11-
|> Str.replace_each(".0}", "}")
12-
|> Str.to_utf8
13-
|> List.drop_if |c| [' ', '\t', '\n'] |> List.contains c
14-
|> Str.from_utf8
8+
result
9+
|> Result.try(
10+
|string|
11+
string
12+
|> Str.replace_each(".0,", ",")
13+
|> Str.replace_each(".0}", "}")
14+
|> Str.to_utf8
15+
|> List.drop_if |c| [' ', '\t', '\n'] |> List.contains(c)
16+
|> Str.from_utf8
17+
)
1518

1619
{% for supercase in cases %}
1720
##

exercises/practice/rest-api/rest-api-test.roc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ import RestApi exposing [get, post]
1515

1616
standardize_result = |result|
1717
result
18-
|> Result.try |string|
19-
string
20-
|> Str.replace_each(".0,", ",")
21-
|> Str.replace_each(".0}", "}")
22-
|> Str.to_utf8
23-
|> List.drop_if |c| [' ', '\t', '\n'] |> List.contains c
24-
|> Str.from_utf8
18+
|> Result.try(
19+
|string|
20+
string
21+
|> Str.replace_each(".0,", ",")
22+
|> Str.replace_each(".0}", "}")
23+
|> Str.to_utf8
24+
|> List.drop_if |c| [' ', '\t', '\n'] |> List.contains(c)
25+
|> Str.from_utf8,
26+
)
2527

2628
##
2729
## user management

0 commit comments

Comments
 (0)