Skip to content

Commit 50d9081

Browse files
const
1 parent 36b6ae1 commit 50d9081

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

exercises/practice/allergies/run_test.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn test_list_everything() {
194194
Allergen.strawberries, Allergen.tomatoes, Allergen.chocolate, Allergen.pollen, Allergen.cats])
195195
}
196196

197-
fn compare(left voidptr, right voidptr) int {
197+
fn compare(left &Allergen, right &Allergen) int {
198198
return int(left) - int(right)
199199
}
200200

exercises/practice/custom-set/.meta/example.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,3 @@ pub fn (s CustomSet[T]) is_subset[T](other CustomSet[T]) bool {
7474
pub fn (s CustomSet[T]) is_disjoint[T](other CustomSet[T]) bool {
7575
return s.intersection(other).is_empty()
7676
}
77-

exercises/practice/custom-set/run_test.v

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
module main
22

3-
const (
4-
empty = CustomSet.new([]int{})
5-
another_empty = CustomSet.new([]int{})
6-
non_empty = CustomSet.new([1])
7-
)
3+
const empty = CustomSet.new([]int{})
4+
const another_empty = CustomSet.new([]int{})
5+
const non_empty = CustomSet.new([1])
86

97
// is_empty
108

exercises/practice/isbn-verifier/.meta/example.v

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ module main
33
import arrays { group, sum }
44
import regex { regex_opt }
55

6-
const (
7-
isbn_len = 10
6+
const isbn_len = 10
87

9-
/*
8+
/*
109
Using a regular expression, I now have two problems:
1110
1211
https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/
@@ -15,10 +14,10 @@ const (
1514
- length check
1615
- character validation
1716
*/
18-
isbn_re = regex_opt(r'^\d{9}(\d|X)$') or { panic('Invalid ISBN-10 regular expression') }
19-
weights = []int{len: isbn_len, init: isbn_len - index} // [10, 9, 8, ..., 1]
20-
zero = int(`0`)
21-
)
17+
const isbn_re = regex_opt(r'^\d{9}(\d|X)$') or { panic('Invalid ISBN-10 regular expression') }
18+
const weights = []int{len: isbn_len, init: isbn_len - index} // [10, 9, 8, ..., 1]
19+
20+
const zero = int(`0`)
2221

2322
// convert single digit (`0`...`9`) to its integer equivalent.
2423
fn digit_to_int(d u8) int {

0 commit comments

Comments
 (0)