Skip to content

Commit 9f28dd4

Browse files
authored
sublist: Sync with problem specifications (#688)
* sync tests * implement tests * sync docs * add instructions append * use two spaces for indentation * update starter file * relax the input type requirements * update config * remove the mention of lists in the instructions append * add missing top-level heading in append file * remove mention of sequential collections from append file
1 parent b457dce commit 9f28dd4

File tree

6 files changed

+86
-45
lines changed

6 files changed

+86
-45
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Instructions append
2+
3+
## Appendix
4+
5+
~~~~exercism/note
6+
The instructions above are synchronized with a shared repository to ensure consistency across all language tracks.
7+
This appendix provides additional clarification or modifies the instructions as needed to better align with the goals of the Clojure track.
8+
~~~~
9+
10+
For this exercise in the Clojure track, you may **assume the input is a vector**, as indicated by the tests.
11+
However, this is not a strict requirement.

exercises/practice/sublist/.docs/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Given any two lists `A` and `B`, determine if:
88
- None of the above is true, thus lists `A` and `B` are unequal
99

1010
Specifically, list `A` is equal to list `B` if both lists have the same values in the same order.
11-
List `A` is a superlist of `B` if `A` contains a sub-sequence of values equal to `B`.
12-
List `A` is a sublist of `B` if `B` contains a sub-sequence of values equal to `A`.
11+
List `A` is a superlist of `B` if `A` contains a contiguous sub-sequence of values equal to `B`.
12+
List `A` is a sublist of `B` if `B` contains a contiguous sub-sequence of values equal to `A`.
1313

1414
Examples:
1515

exercises/practice/sublist/.meta/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"contributors": [
66
"AndreaCrotti",
77
"haus",
8-
"yurrriq"
8+
"yurrriq",
9+
"tasxatzial"
910
],
1011
"files": {
1112
"solution": [

exercises/practice/sublist/.meta/tests.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[97319c93-ebc5-47ab-a022-02a1980e1d29]
613
description = "empty lists"
@@ -47,6 +54,9 @@ description = "first list missing element from second list"
4754
[83ffe6d8-a445-4a3c-8795-1e51a95e65c3]
4855
description = "second list missing element from first list"
4956

57+
[7bc76cb8-5003-49ca-bc47-cdfbe6c2bb89]
58+
description = "first list missing additional digits from second list"
59+
5060
[0d7ee7c1-0347-45c8-9ef5-b88db152b30b]
5161
description = "order matters to a list"
5262

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(ns sublist)
22

3-
(defn classify [list1 list2] ;; <- arglist goes here
4-
;; your code goes here
5-
)
3+
(defn classify
4+
[coll1 coll2]
5+
;; function body
6+
)

exercises/practice/sublist/test/sublist_test.clj

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,74 @@
22
(:require [clojure.test :refer [deftest is testing]]
33
sublist))
44

5-
(deftest empty-lists-test
6-
(is (= :equal (sublist/classify [] []))))
5+
(deftest test-97319c93-ebc5-47ab-a022-02a1980e1d29
6+
(testing "Empty lists"
7+
(is (= :equal (sublist/classify [] [])))))
78

8-
(deftest empty-list-within-non-empty-list-test
9-
(is (= :sublist (sublist/classify [] [1 2 3]))))
9+
(deftest test-de27dbd4-df52-46fe-a336-30be58457382
10+
(testing "Empty list within non empty list"
11+
(is (= :sublist (sublist/classify [] [1 2 3])))))
1012

11-
(deftest non-empty-list-contains-empty-list-test
12-
(is (= :superlist (sublist/classify [1 2 3] []))))
13+
(deftest test-5487cfd1-bc7d-429f-ac6f-1177b857d4fb
14+
(testing "Non empty list contains empty list"
15+
(is (= :superlist (sublist/classify [1 2 3] [])))))
1316

14-
(deftest list-equals-itself-test
15-
(is (= :equal (sublist/classify [1 2 3] [1 2 3]))))
17+
(deftest test-1f390b47-f6b2-4a93-bc23-858ba5dda9a6
18+
(testing "List equals itself"
19+
(is (= :equal (sublist/classify [1 2 3] [1 2 3])))))
1620

17-
(deftest different-lists
18-
(is (= :unequal (sublist/classify [1 2 3] [2 3 4]))))
21+
(deftest test-7ed2bfb2-922b-4363-ae75-f3a05e8274f5
22+
(testing "Different lists"
23+
(is (= :unequal (sublist/classify [1 2 3] [2 3 4])))))
1924

20-
(deftest false-start
21-
(is (= :sublist (sublist/classify [1 2 5] [0 1 2 3 1 2 5 6]))))
25+
(deftest test-3b8a2568-6144-4f06-b0a1-9d266b365341
26+
(testing "False start"
27+
(is (= :sublist (sublist/classify [1 2 5] [0 1 2 3 1 2 5 6])))))
2228

23-
(deftest consecutive
24-
(is (= :sublist (sublist/classify [1 1 2] [0 1 1 1 2 1 2]))))
29+
(deftest test-dc39ed58-6311-4814-be30-05a64bc8d9b1
30+
(testing "Consecutive"
31+
(is (= :sublist (sublist/classify [1 1 2] [0 1 1 1 2 1 2])))))
2532

26-
(deftest sublist-at-start
27-
(is (= :sublist (sublist/classify [0 1 2] [0 1 2 3 4 5]))))
33+
(deftest test-d1270dab-a1ce-41aa-b29d-b3257241ac26
34+
(testing "Sublist at start"
35+
(is (= :sublist (sublist/classify [0 1 2] [0 1 2 3 4 5])))))
2836

29-
(deftest sublist-in-middle
30-
(is (= :sublist (sublist/classify [2 3 4] [0 1 2 3 4 5]))))
37+
(deftest test-81f3d3f7-4f25-4ada-bcdc-897c403de1b6
38+
(testing "Sublist in middle"
39+
(is (= :sublist (sublist/classify [2 3 4] [0 1 2 3 4 5])))))
3140

32-
(deftest sublist-at-end
33-
(is (= :sublist (sublist/classify [3 4 5] [0 1 2 3 4 5]))))
41+
(deftest test-43bcae1e-a9cf-470e-923e-0946e04d8fdd
42+
(testing "Sublist at end"
43+
(is (= :sublist (sublist/classify [3 4 5] [0 1 2 3 4 5])))))
3444

35-
(deftest at-start-of-superlist
36-
(is (= :superlist (sublist/classify [0 1 2 3 4 5] [0 1 2]))))
45+
(deftest test-76cf99ed-0ff0-4b00-94af-4dfb43fe5caa
46+
(testing "At start of superlist"
47+
(is (= :superlist (sublist/classify [0 1 2 3 4 5] [0 1 2])))))
3748

38-
(deftest in-middle-of-superlist
39-
(is (= :superlist (sublist/classify [0 1 2 3 4 5] [2 3]))))
49+
(deftest test-b83989ec-8bdf-4655-95aa-9f38f3e357fd
50+
(testing "In middle of superlist"
51+
(is (= :superlist (sublist/classify [0 1 2 3 4 5] [2 3])))))
4052

41-
(deftest at-end-of-superlist
42-
(is (= :superlist (sublist/classify [0 1 2 3 4 5] [3 4 5]))))
53+
(deftest test-26f9f7c3-6cf6-4610-984a-662f71f8689b
54+
(testing "At end of superlist"
55+
(is (= :superlist (sublist/classify [0 1 2 3 4 5] [3 4 5])))))
4356

44-
(deftest first-list-missing-element-from-second-list
45-
(is (= :unequal (sublist/classify [1 3] [1 2 3]))))
57+
(deftest test-0a6db763-3588-416a-8f47-76b1cedde31e
58+
(testing "First list missing element from second list"
59+
(is (= :unequal (sublist/classify [1 3] [1 2 3])))))
4660

47-
(deftest second-list-missing-element-from-first-list
48-
(is (= :unequal (sublist/classify [1 2 3] [1 3]))))
61+
(deftest test-83ffe6d8-a445-4a3c-8795-1e51a95e65c3
62+
(testing "Second list missing element from first list"
63+
(is (= :unequal (sublist/classify [1 2 3] [1 3])))))
4964

50-
(deftest order-matters-to-a-list
51-
(is (= :unequal (sublist/classify [1 2 3] [3 2 1]))))
65+
(deftest test-7bc76cb8-5003-49ca-bc47-cdfbe6c2bb89
66+
(testing "First list missing additional digits from second list"
67+
(is (= :unequal (sublist/classify [1 2] [1 22])))))
5268

53-
(deftest same-digits-but-different-numbers
54-
(is (= :unequal (sublist/classify [1 0 1] [10 1]))))
69+
(deftest test-0d7ee7c1-0347-45c8-9ef5-b88db152b30b
70+
(testing "Order matters to a list"
71+
(is (= :unequal (sublist/classify [1 2 3] [3 2 1])))))
5572

56-
(deftest second-list-continues-first-list
57-
(is (= :unequal (sublist/classify [1] [2 3]))))
73+
(deftest test-5f47ce86-944e-40f9-9f31-6368aad70aa6
74+
(testing "Same digits but different numbers"
75+
(is (= :unequal (sublist/classify [1 0 1] [10 1])))))

0 commit comments

Comments
 (0)