trackler 2.0.0.6 → 2.0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitmodules +1 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/prolog/README.md +70 -6
- data/tracks/prolog/bin/build.sh +1 -5
- data/tracks/prolog/docs/ABOUT.md +9 -0
- data/tracks/prolog/docs/INSTALLATION.md +8 -0
- data/tracks/prolog/docs/LEARNING.md +6 -0
- data/tracks/prolog/docs/RESOURCES.md +4 -0
- data/tracks/prolog/docs/TESTS.md +30 -0
- data/tracks/prolog/exercises/anagram/anagram_tests.plt +26 -19
- data/tracks/prolog/exercises/binary/binary_tests.plt +24 -17
- data/tracks/prolog/exercises/grains/grains_tests.plt +20 -13
- data/tracks/prolog/exercises/hamming/hamming_tests.plt +23 -16
- data/tracks/prolog/exercises/hello-world/hello_world.pl +9 -0
- data/tracks/prolog/exercises/hello-world/hello_world_tests.plt +23 -3
- data/tracks/prolog/exercises/leap/leap.pl +1 -1
- data/tracks/prolog/exercises/leap/leap_tests.plt +13 -7
- data/tracks/prolog/exercises/nucleotide-count/nucleotide_count_tests.plt +11 -5
- data/tracks/prolog/exercises/rna-transcription/rna_transcription_tests.plt +16 -9
- data/tracks/prolog/exercises/space-age/space_age_tests.plt +14 -8
- data/tracks/prolog/exercises/sum-of-multiples/sum_of_multiples_tests.plt +20 -13
- data/tracks/prolog/exercises/triangle/triangle_tests.plt +22 -15
- metadata +1 -2
- data/tracks/prolog/exercises/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ede1a059794b17371969bee2e6a0084800e958b3
|
4
|
+
data.tar.gz: 15006a8b2b6a8676d6815acb179bcd5c83536b4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d422468e9102e5055b208c0110d0c57d57c12cbaf46f81d3e237481a130c46566c8e00295000774b7b3287ea4c9a86ab2dfd05a49fa7b0e665d2db8718b727d9
|
7
|
+
data.tar.gz: 87cd0152877bde73b180983227b563a9acad8f2a5a14104bdb522fc82e262fce3388c1c15407b76e61000cb89c9724c968aea870fbfafdd264ed171acbeec783
|
data/.gitmodules
CHANGED
data/lib/trackler/version.rb
CHANGED
data/tracks/prolog/README.md
CHANGED
@@ -1,12 +1,76 @@
|
|
1
|
-
#
|
1
|
+
# xProlog
|
2
2
|

|
3
3
|
|
4
|
-
Exercism
|
4
|
+
Exercism Exercises in Prolog
|
5
5
|
|
6
|
-
##
|
6
|
+
## Setup
|
7
7
|
|
8
|
-
|
8
|
+
See [INSTALLATION.md](https://github.com/exercism/xprolog/blob/master/docs/INSTALLATION.md)
|
9
9
|
|
10
|
-
##
|
10
|
+
##Contributing
|
11
11
|
|
12
|
-
|
12
|
+
Thank you so much for contributing! :tada:
|
13
|
+
|
14
|
+
We welcome pull requests that provide fixes and improvements to existing
|
15
|
+
exercises. If you're unsure, then go ahead and open a GitHub issue, and we'll
|
16
|
+
discuss the change.
|
17
|
+
|
18
|
+
Please keep the following in mind:
|
19
|
+
|
20
|
+
- Please start by reading the general Exercism [contributing guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data).
|
21
|
+
|
22
|
+
- Pull requests should be focused on a single exercise, issue, or change.
|
23
|
+
|
24
|
+
- We welcome changes to code style, and wording. Please open a separate PR for
|
25
|
+
these changes if possible.
|
26
|
+
|
27
|
+
- Please open an issue before creating a PR that makes significant (breaking)
|
28
|
+
changes to an existing exercise or makes changes across many exercises. It is
|
29
|
+
best to discuss these changes before doing the work.
|
30
|
+
|
31
|
+
- Watch out for trailing spaces, extra blank lines, and spaces in blank lines.
|
32
|
+
|
33
|
+
- Each exercise must stand on its own. Do not reference files outside the
|
34
|
+
exercise directory. They will not be included when the user fetches the
|
35
|
+
exercise.
|
36
|
+
|
37
|
+
- Please do not add a README or README.md file to the exercise directory. The
|
38
|
+
READMEs are constructed using shared metadata, which lives in the [exercism/x-common](https://github.com/exercism/x-common) repository.
|
39
|
+
|
40
|
+
- Each problem should have a test suite, an example solution, and a template
|
41
|
+
file for the real implementation. The example solution should have the
|
42
|
+
`.example` file extension.
|
43
|
+
|
44
|
+
- Each test file should have code like the following at the top of the file.
|
45
|
+
This allows the tests to be run on CI and configures tests to be skipped with
|
46
|
+
the `condition(pending)` flag.
|
47
|
+
|
48
|
+
```prolog
|
49
|
+
pending :-
|
50
|
+
current_prolog_flag(argv, ['--all'|_]).
|
51
|
+
pending :-
|
52
|
+
write('\nA TEST IS PENDING!\n'),
|
53
|
+
fail.
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
- All but the initial test for each exercise should be`condition(pending)`. The
|
58
|
+
first test should have `condition(true)` as an example of how to change the
|
59
|
+
tests to run. Here are the first two tests in the `hello_world` exercise.
|
60
|
+
|
61
|
+
```prolog
|
62
|
+
test(hello_world, condition(true)) :-
|
63
|
+
hello_world('Hello World!').
|
64
|
+
|
65
|
+
test(hello_world_with_a_name, condition(pending)) :-
|
66
|
+
hello_world('Alice', 'Hello Alice!').
|
67
|
+
```
|
68
|
+
|
69
|
+
All the tests for xProlog exercises can be run from the top level of the repo
|
70
|
+
with `bin/build.sh`. Please run this command before submitting your PR.
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The MIT License (MIT)
|
75
|
+
|
76
|
+
Copyright (c) 2016 Katrina Owen, _@kytrinyx.com
|
data/tracks/prolog/bin/build.sh
CHANGED
@@ -5,17 +5,13 @@ for example_file in exercises/**/*.example
|
|
5
5
|
do
|
6
6
|
exercise_dir=$(dirname $example_file)
|
7
7
|
exercise=$(basename $example_file .example)
|
8
|
-
mv "$exercise_dir/$exercise.pl" "$exercise_dir/$exercise.impl"
|
9
|
-
mv "$exercise_dir/$exercise.example" "$exercise_dir/$exercise.pl"
|
10
8
|
echo '-------------------------------------------------------'
|
11
9
|
echo "Testing $exercise"
|
12
|
-
swipl -f "$exercise_dir/$exercise.
|
10
|
+
swipl -f "$exercise_dir/$exercise.example" -s "$exercise_dir/${exercise}_tests.plt" -g run_tests,halt -t 'halt(1)' -- --all
|
13
11
|
if [ $? -ne 0 ]; then
|
14
12
|
TEST_RESULT=1
|
15
13
|
FAILED_EXERCISES+="$exercise\n"
|
16
14
|
fi
|
17
|
-
mv "$exercise_dir/$exercise.pl" "$exercise_dir/$exercise.example"
|
18
|
-
mv "$exercise_dir/$exercise.impl" "$exercise_dir/$exercise.pl"
|
19
15
|
done
|
20
16
|
|
21
17
|
if [ $TEST_RESULT -ne 0 ]; then
|
data/tracks/prolog/docs/ABOUT.md
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
Prolog-- short for "Programming Logic"-- is a
|
2
|
+
[declarative](https://en.wikipedia.org/wiki/Declarative_programming) and logic
|
3
|
+
based programming language developed in 1972 by Alain Colmerauer and Philippe
|
4
|
+
Roussel. It has many applications, most notably in Artificial Intelligence for
|
5
|
+
its pattern matching abilities over natural language parse trees.
|
6
|
+
|
7
|
+
Prolog is written in "facts" and "rules" that define logical formulas, similar
|
8
|
+
to functional programs. Learning Prolog is a great way to improve skills with
|
9
|
+
recursion, predicate logic, and constraint logic programming.
|
@@ -0,0 +1,8 @@
|
|
1
|
+
##Installation
|
2
|
+
|
3
|
+
**Mac Users**: Install using homebrew with `brew install swi-prolog`. Alternatively, download the source for your machine from the (SWI Prolog Website)[http://www.swi-prolog.org/download/stable].
|
4
|
+
|
5
|
+
**Windows Users**: Download the source for your machine from the (SWI Prolog Website)[http://www.swi-prolog.org/download/stable].
|
6
|
+
|
7
|
+
**Linux Users**: Follow the instructions for your distro from (here)[http://www.swi-prolog.org/build/LinuxDistro.txt].
|
8
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
## References
|
2
|
+
* [SWI-Prolog Getting Started](http://www.swi-prolog.org/pldoc/man?section=quickstart)
|
3
|
+
* [Tutorials and Resources](http://www.swi-prolog.org/Links.html)
|
4
|
+
* [Seven Languages in Seven Weeks by Bruce A. Tate - Chapter 4](https://pragprog.com/book/btlang/seven-languages-in-seven-weeks)
|
5
|
+
* [Learn Prolog Now](http://www.learnprolognow.org)
|
6
|
+
* [prolog :- tutorial](https://www.cpp.edu/~jrfisher/www/prolog_tutorial/pt_framer.html)
|
data/tracks/prolog/docs/TESTS.md
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
##Running Tests
|
2
|
+
|
3
|
+
SWI Prolog can either be run interactively or by executing it directly at the
|
4
|
+
command line.
|
5
|
+
|
6
|
+
To run prolog interactively first run:
|
7
|
+
|
8
|
+
`$ swipl`
|
9
|
+
|
10
|
+
After the prolog console starts, load your implementation and run the tests
|
11
|
+
with:
|
12
|
+
|
13
|
+
```
|
14
|
+
?- ["hello_world.pl"].
|
15
|
+
?- ["hello_world_tests.plt"].
|
16
|
+
?- run_tests.
|
17
|
+
```
|
18
|
+
|
19
|
+
To run your implementation directly run:
|
20
|
+
|
21
|
+
`swipl -f hello_world.pl -s hello_world_tests.plt -g run_tests,halt -t
|
22
|
+
'halt(1)'`
|
23
|
+
|
24
|
+
In both cases, replace `hello_world.pl` and `hello_world_tests.plt` with the
|
25
|
+
name of the exercise you are implementing.
|
26
|
+
|
27
|
+
When you first begin an exercise, only the first test will run. The rest have
|
28
|
+
been skipped by adding `condition(pedning)` to the `test` goal. Once the first
|
29
|
+
test passes, un-skip the next test by changing `pending` in `condition(pedning)`
|
30
|
+
to `true`. Repeat for each test until they are all running and passing.
|
@@ -1,57 +1,64 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(anagram).
|
2
8
|
|
3
|
-
test(no_matches) :-
|
4
|
-
anagram("diaper", [ "hello", "world", "zombies", "pants"],
|
9
|
+
test(no_matches, condition(true)) :-
|
10
|
+
anagram("diaper", [ "hello", "world", "zombies", "pants"], Result),
|
11
|
+
is_list(Result).
|
5
12
|
|
6
|
-
test(detects_simple_anagram) :-
|
13
|
+
test(detects_simple_anagram, condition(pending)) :-
|
7
14
|
anagram("ant", ["tan", "stand", "at"], ["tan"]).
|
8
15
|
|
9
|
-
test(does_not_detect_false_positives) :-
|
16
|
+
test(does_not_detect_false_positives, condition(pending)) :-
|
10
17
|
anagram("galea", ["eagle"], []).
|
11
18
|
|
12
|
-
test(detects_multiple_anagrams) :-
|
19
|
+
test(detects_multiple_anagrams, condition(pending)) :-
|
13
20
|
anagram("master", ["stream", "pigeon", "maters"], ["stream", "maters"]).
|
14
21
|
|
15
|
-
test(does_not_detect_anagram_subsets) :-
|
22
|
+
test(does_not_detect_anagram_subsets, condition(pending)) :-
|
16
23
|
anagram("good", ["dog", "goody"], []).
|
17
24
|
|
18
|
-
test(detects_anagram) :-
|
25
|
+
test(detects_anagram, condition(pending)) :-
|
19
26
|
anagram("listen", ["enlists", "google", "inlets", "banana"], ["inlets"]).
|
20
27
|
|
21
|
-
test(detects_multiple_anagrams) :-
|
28
|
+
test(detects_multiple_anagrams, condition(pending)) :-
|
22
29
|
anagram("allergy", ["gallery", "ballerina", "regally", "clergy", "largely", "leading"], ["gallery", "regally", "largely"]).
|
23
30
|
|
24
|
-
test(does_not_detect_identical_words) :-
|
31
|
+
test(does_not_detect_identical_words, condition(pending)) :-
|
25
32
|
anagram("corn", ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"], ["cron"]).
|
26
33
|
|
27
|
-
test(does_not_detect_nonanagrams_with_identical_checksum) :-
|
34
|
+
test(does_not_detect_nonanagrams_with_identical_checksum, condition(pending)) :-
|
28
35
|
anagram("mass", ["last"], []).
|
29
36
|
|
30
|
-
test(detects_anagrams_case_insensitively) :-
|
37
|
+
test(detects_anagrams_case_insensitively, condition(pending)) :-
|
31
38
|
anagram("Orchestra", ["cashregister", "Carthorse", "radishes"], ["Carthorse"]).
|
32
39
|
|
33
|
-
test(detects_anagrams_using_case_insensitive_subject) :-
|
40
|
+
test(detects_anagrams_using_case_insensitive_subject, condition(pending)) :-
|
34
41
|
anagram("Orchestra", ["cashregister", "carthorse", "radishes"], ["carthorse"]).
|
35
42
|
|
36
|
-
test(detects_anagrams_using_case_insensitive_possible_matches) :-
|
43
|
+
test(detects_anagrams_using_case_insensitive_possible_matches, condition(pending)) :-
|
37
44
|
anagram("orchestra", ["cashregister", "Carthorse", "radishes"], ["Carthorse"]).
|
38
45
|
|
39
|
-
test(does_not_detect_a_word_as_its_own_anagram) :-
|
46
|
+
test(does_not_detect_a_word_as_its_own_anagram, condition(pending)) :-
|
40
47
|
anagram("banana", ["Banana"], []).
|
41
48
|
|
42
|
-
test(does_not_detect_a_anagram_if_the_original_word_is_repeated) :-
|
49
|
+
test(does_not_detect_a_anagram_if_the_original_word_is_repeated, condition(pending)) :-
|
43
50
|
anagram("go", ["go Go GO"], []).
|
44
51
|
|
45
|
-
test(anagrams_must_use_all_letters_exactly_once) :-
|
52
|
+
test(anagrams_must_use_all_letters_exactly_once, condition(pending)) :-
|
46
53
|
anagram("tapper", ["patter"], []).
|
47
54
|
|
48
|
-
test(detects_unicode_anagrams) :-
|
55
|
+
test(detects_unicode_anagrams, condition(pending)) :-
|
49
56
|
anagram("ΑΒΓ", ["ΒΓΑ", "ΒΓΔ", "γβα"], ["ΒΓΑ", "γβα"]).
|
50
57
|
|
51
|
-
test(eliminates_misleading_unicode_anagrams) :-
|
58
|
+
test(eliminates_misleading_unicode_anagrams, condition(pending)) :-
|
52
59
|
anagram("ΑΒΓ", ["ABΓ"], []).
|
53
60
|
|
54
|
-
test(capital_word_is_not_own_anagram) :-
|
61
|
+
test(capital_word_is_not_own_anagram, condition(pending)) :-
|
55
62
|
anagram("BANANA", ["Banana"], []).
|
56
63
|
|
57
64
|
:- end_tests(anagram).
|
@@ -1,51 +1,58 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(binary).
|
2
8
|
|
3
|
-
test(binary_0_is_decimal_0) :-
|
4
|
-
binary("0",
|
9
|
+
test(binary_0_is_decimal_0, condition(true)) :-
|
10
|
+
binary("0", Result),
|
11
|
+
Result == 0.
|
5
12
|
|
6
|
-
test(binary_0_is_decimal_0) :-
|
13
|
+
test(binary_0_is_decimal_0, condition(pending)) :-
|
7
14
|
binary("0", 0).
|
8
15
|
|
9
|
-
test(binary_1_is_decimal_1) :-
|
16
|
+
test(binary_1_is_decimal_1, condition(pending)) :-
|
10
17
|
binary("1", 1).
|
11
18
|
|
12
|
-
test(binary_10_is_decimal_2) :-
|
19
|
+
test(binary_10_is_decimal_2, condition(pending)) :-
|
13
20
|
binary("10", 2).
|
14
21
|
|
15
|
-
test(binary_11_is_decimal_3) :-
|
22
|
+
test(binary_11_is_decimal_3, condition(pending)) :-
|
16
23
|
binary("11", 3).
|
17
24
|
|
18
|
-
test(binary_100_is_decimal_4) :-
|
25
|
+
test(binary_100_is_decimal_4, condition(pending)) :-
|
19
26
|
binary("100", 4).
|
20
27
|
|
21
|
-
test(binary_1001_is_decimal_9) :-
|
28
|
+
test(binary_1001_is_decimal_9, condition(pending)) :-
|
22
29
|
binary("1001", 9).
|
23
30
|
|
24
|
-
test(binary_11010_is_decimal_26) :-
|
31
|
+
test(binary_11010_is_decimal_26, condition(pending)) :-
|
25
32
|
binary("11010", 26).
|
26
33
|
|
27
|
-
test(binary_10001101000_is_decimal_1128) :-
|
34
|
+
test(binary_10001101000_is_decimal_1128, condition(pending)) :-
|
28
35
|
binary("10001101000", 1128).
|
29
36
|
|
30
|
-
test(binary_ignores_leading_zeros) :-
|
37
|
+
test(binary_ignores_leading_zeros, condition(pending)) :-
|
31
38
|
binary("000011111", 31).
|
32
39
|
|
33
|
-
test(two_is_not_a_valid_binary_digit, [fail]) :-
|
40
|
+
test(two_is_not_a_valid_binary_digit, [fail, condition(pending)]) :-
|
34
41
|
binary("2", _).
|
35
42
|
|
36
|
-
test(nonbinary_digit_is_invalid, [fail]) :-
|
43
|
+
test(nonbinary_digit_is_invalid, [fail, condition(pending)]) :-
|
37
44
|
binary("01201", _).
|
38
45
|
|
39
|
-
test(trailing_nonbinary_characters_is_invalid, [fail]) :-
|
46
|
+
test(trailing_nonbinary_characters_is_invalid, [fail, condition(pending)]) :-
|
40
47
|
binary("10nope", _).
|
41
48
|
|
42
|
-
test(nonbinary_characters_is_invalid, [fail]) :-
|
49
|
+
test(nonbinary_characters_is_invalid, [fail, condition(pending)]) :-
|
43
50
|
binary("nope10", _).
|
44
51
|
|
45
|
-
test(internal_nonbinary_characters_is_invalid, [fail]) :-
|
52
|
+
test(internal_nonbinary_characters_is_invalid, [fail, condition(pending)]) :-
|
46
53
|
binary("10nope10", _).
|
47
54
|
|
48
|
-
test(whitespace_separated_is_invalid, [fail]) :-
|
55
|
+
test(whitespace_separated_is_invalid, [fail, condition(pending)]) :-
|
49
56
|
binary("001 nope", _).
|
50
57
|
|
51
58
|
:- end_tests(binary).
|
@@ -1,39 +1,46 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(grains).
|
2
8
|
|
3
|
-
test(first) :-
|
4
|
-
square(1,
|
9
|
+
test(first, condition(true)) :-
|
10
|
+
square(1, Result),
|
11
|
+
Result == 1.
|
5
12
|
|
6
|
-
test(second) :-
|
13
|
+
test(second, condition(pending)) :-
|
7
14
|
square(2, 2).
|
8
15
|
|
9
|
-
test(third) :-
|
16
|
+
test(third, condition(pending)) :-
|
10
17
|
square(3, 4).
|
11
18
|
|
12
|
-
test(sixteen) :-
|
19
|
+
test(sixteen, condition(pending)) :-
|
13
20
|
square(16, 32768).
|
14
21
|
|
15
|
-
test(twenty_three) :-
|
22
|
+
test(twenty_three, condition(pending)) :-
|
16
23
|
square(23, 4194304).
|
17
24
|
|
18
|
-
test(thirty_two) :-
|
25
|
+
test(thirty_two, condition(pending)) :-
|
19
26
|
square(32, 2147483648).
|
20
27
|
|
21
|
-
test(fifty_five) :-
|
28
|
+
test(fifty_five, condition(pending)) :-
|
22
29
|
square(55, 18014398509481984).
|
23
30
|
|
24
|
-
test(sixty_four) :-
|
31
|
+
test(sixty_four, condition(pending)) :-
|
25
32
|
square(64, 9223372036854775808).
|
26
33
|
|
27
|
-
test(total) :-
|
34
|
+
test(total, condition(pending)) :-
|
28
35
|
total(18446744073709551615).
|
29
36
|
|
30
|
-
test(zero, [fail]) :-
|
37
|
+
test(zero, [fail, condition(pending)]) :-
|
31
38
|
square(0, _).
|
32
39
|
|
33
|
-
test(negative, [fail]) :-
|
40
|
+
test(negative, [fail, condition(pending)]) :-
|
34
41
|
square(-1, _).
|
35
42
|
|
36
|
-
test(off_board, [fail]) :-
|
43
|
+
test(off_board, [fail, condition(pending)]) :-
|
37
44
|
square(65, _).
|
38
45
|
|
39
46
|
:- end_tests(grains).
|
@@ -1,48 +1,55 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(hamming).
|
2
8
|
|
3
|
-
test(identical_strands) :-
|
4
|
-
hamming_distance("A", "A",
|
9
|
+
test(identical_strands, condition(true)) :-
|
10
|
+
hamming_distance("A", "A", Result),
|
11
|
+
Result == 0.
|
5
12
|
|
6
|
-
test(long_identical_strands) :-
|
13
|
+
test(long_identical_strands, condition(pending)) :-
|
7
14
|
hamming_distance("GGACTGA", "GGACTGA", 0).
|
8
15
|
|
9
|
-
test(complete_distance_in_single_nucleotide_strands) :-
|
16
|
+
test(complete_distance_in_single_nucleotide_strands, condition(pending)) :-
|
10
17
|
hamming_distance("A", "G", 1).
|
11
18
|
|
12
|
-
test(complete_distance_in_small_strands) :-
|
19
|
+
test(complete_distance_in_small_strands, condition(pending)) :-
|
13
20
|
hamming_distance("AG", "CT", 2).
|
14
21
|
|
15
|
-
test(small_distance_in_small_strands) :-
|
22
|
+
test(small_distance_in_small_strands, condition(pending)) :-
|
16
23
|
hamming_distance("AT", "CT", 1).
|
17
24
|
|
18
|
-
test(small_distance) :-
|
25
|
+
test(small_distance, condition(pending)) :-
|
19
26
|
hamming_distance("GGACG", "GGTCG", 1).
|
20
27
|
|
21
|
-
test(small_distance_in_long_strands) :-
|
28
|
+
test(small_distance_in_long_strands, condition(pending)) :-
|
22
29
|
hamming_distance("ACCAGGG", "ACTATGG", 2).
|
23
30
|
|
24
|
-
test(nonunique_character_in_first_strand) :-
|
31
|
+
test(nonunique_character_in_first_strand, condition(pending)) :-
|
25
32
|
hamming_distance("AGA", "AGG", 1).
|
26
33
|
|
27
|
-
test(nonunique_character_in_second_strand) :-
|
34
|
+
test(nonunique_character_in_second_strand, condition(pending)) :-
|
28
35
|
hamming_distance("AGG", "AGA", 1).
|
29
36
|
|
30
|
-
test(same_nucleotides_in_different_positions) :-
|
37
|
+
test(same_nucleotides_in_different_positions, condition(pending)) :-
|
31
38
|
hamming_distance("TAG", "GAT", 2).
|
32
39
|
|
33
|
-
test(large_distance) :-
|
40
|
+
test(large_distance, condition(pending)) :-
|
34
41
|
hamming_distance("GATACA", "GCATAA", 4).
|
35
42
|
|
36
|
-
test(large_distance_in_offbyone_strand) :-
|
43
|
+
test(large_distance_in_offbyone_strand, condition(pending)) :-
|
37
44
|
hamming_distance("GGACGGATTCTG", "AGGACGGATTCT", 9).
|
38
45
|
|
39
|
-
test(empty_strands) :-
|
46
|
+
test(empty_strands, condition(pending)) :-
|
40
47
|
hamming_distance("", "", 0).
|
41
48
|
|
42
|
-
test(disallow_first_strand_longer, [fail]) :-
|
49
|
+
test(disallow_first_strand_longer, [fail, condition(pending)]) :-
|
43
50
|
hamming_distance("AATG", "AAA", _).
|
44
51
|
|
45
|
-
test(disallow_second_strand_longer, [fail]) :-
|
52
|
+
test(disallow_second_strand_longer, [fail, condition(pending)]) :-
|
46
53
|
hamming_distance("ATA", "AGTG", _).
|
47
54
|
|
48
55
|
:- end_tests(hamming).
|
@@ -0,0 +1,9 @@
|
|
1
|
+
% Please visit http://exercism.io/languages/prolog/installing
|
2
|
+
% for instructions on setting up prolog.
|
3
|
+
% Visit http://exercism.io/languages/prolog/tests
|
4
|
+
% for help running the tests for prolog exercises.
|
5
|
+
|
6
|
+
% Replace the goal below with
|
7
|
+
% your implementation.
|
8
|
+
|
9
|
+
hello_world(false).
|
@@ -1,11 +1,31 @@
|
|
1
|
+
% Please visit http://exercism.io/languages/prolog/installing
|
2
|
+
% for instructions on setting up prolog.
|
3
|
+
% Visit http://exercism.io/languages/prolog/tests
|
4
|
+
% for help running the tests for prolog exercises.
|
5
|
+
|
6
|
+
% The goal below allows tests to be skipped
|
7
|
+
% unless the "--all" flag is passed at
|
8
|
+
% the command line.
|
9
|
+
|
10
|
+
pending :-
|
11
|
+
current_prolog_flag(argv, ['--all'|_]).
|
12
|
+
pending :-
|
13
|
+
write('\nA TEST IS PENDING!\n'),
|
14
|
+
fail.
|
15
|
+
|
1
16
|
:- begin_tests(hello_word).
|
2
|
-
|
17
|
+
|
18
|
+
test(hello_world, condition(true)) :-
|
3
19
|
hello_world('Hello World!').
|
4
20
|
|
5
|
-
test
|
21
|
+
% Once the first test passes, un-skip the following test by
|
22
|
+
% changing `pending` in `condition(pedning)` to `true`.
|
23
|
+
% Repeat for each test until they are all passing.
|
24
|
+
|
25
|
+
test(hello_world_with_a_name, condition(pending)) :-
|
6
26
|
hello_world('Alice', 'Hello Alice!').
|
7
27
|
|
8
|
-
test(
|
28
|
+
test(hello_world_another_name, condition(pending)) :-
|
9
29
|
hello_world('Bob', 'Hello Bob!').
|
10
30
|
|
11
31
|
:- end_tests(hello_word).
|
@@ -1 +1 @@
|
|
1
|
-
leap(
|
1
|
+
leap(0).
|
@@ -1,24 +1,30 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(leap_tests).
|
2
8
|
|
3
|
-
test(leap_year) :-
|
9
|
+
test(leap_year, condition(true)) :-
|
4
10
|
leap(1996).
|
5
11
|
|
6
|
-
test(standard_and_odd_year) :-
|
12
|
+
test(standard_and_odd_year, condition(pending)) :-
|
7
13
|
not(leap(1997)).
|
8
14
|
|
9
|
-
test(standard_even_year) :-
|
15
|
+
test(standard_even_year, condition(pending)) :-
|
10
16
|
not(leap(1998)).
|
11
17
|
|
12
|
-
test(standard_nineteeth_century) :-
|
18
|
+
test(standard_nineteeth_century, condition(pending)) :-
|
13
19
|
not(leap(1900)).
|
14
20
|
|
15
|
-
test(standard_eighteenth_century) :-
|
21
|
+
test(standard_eighteenth_century, condition(pending)) :-
|
16
22
|
not(leap(1800)).
|
17
23
|
|
18
|
-
test(leap_twenty_fourth_century) :-
|
24
|
+
test(leap_twenty_fourth_century, condition(pending)) :-
|
19
25
|
leap(2400).
|
20
26
|
|
21
|
-
test(leap_y2k) :-
|
27
|
+
test(leap_y2k, condition(pending)) :-
|
22
28
|
leap(2000).
|
23
29
|
|
24
30
|
:- end_tests(leap_tests).
|
@@ -1,22 +1,28 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(nucleotide_counting).
|
2
8
|
|
3
|
-
test(empty_dna_strand_has_no_adenosine) :-
|
9
|
+
test(empty_dna_strand_has_no_adenosine, condition(true)) :-
|
4
10
|
nucleotide_count('', [('A', 0) | _ ]), !.
|
5
11
|
|
6
|
-
test(repetitive_cytidine_gets_counted) :-
|
12
|
+
test(repetitive_cytidine_gets_counted, condition(pending)) :-
|
7
13
|
nucleotide_count('CCCCC', Counts),
|
8
14
|
member(('C', 5), Counts), !.
|
9
15
|
|
10
|
-
test(counts_only_thymidine) :-
|
16
|
+
test(counts_only_thymidine, condition(pending)) :-
|
11
17
|
nucleotide_count('GGGGGTAACCCGG', Counts),
|
12
18
|
member(('T', 1), Counts), !.
|
13
19
|
|
14
|
-
test(counts_only_thymidine) :-
|
20
|
+
test(counts_only_thymidine, condition(pending)) :-
|
15
21
|
nucleotide_count(
|
16
22
|
'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC',
|
17
23
|
[ ('A' ,20), ('C' , 12), ('G' , 17), ('T', 21) ]), !.
|
18
24
|
|
19
|
-
test(fails_when_not_dns, [fail]) :-
|
25
|
+
test(fails_when_not_dns, [fail, condition(pending)]) :-
|
20
26
|
nucleotide_count('JOHNNYAPPLESEED', _), !.
|
21
27
|
|
22
28
|
:- end_tests(nucleotide_counting).
|
@@ -1,27 +1,34 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(rna_transcription).
|
2
8
|
|
3
|
-
test(rna_complement_of_cytosine_is_guanine) :-
|
4
|
-
rna_transcription("C",
|
9
|
+
test(rna_complement_of_cytosine_is_guanine, condition(true)) :-
|
10
|
+
rna_transcription("C", Result),
|
11
|
+
Result == "G".
|
5
12
|
|
6
|
-
test(rna_complement_of_guanine_is_cytosine) :-
|
13
|
+
test(rna_complement_of_guanine_is_cytosine, condition(pending)) :-
|
7
14
|
rna_transcription("G", "C").
|
8
15
|
|
9
|
-
test(rna_complement_of_thymine_is_adenine) :-
|
16
|
+
test(rna_complement_of_thymine_is_adenine, condition(pending)) :-
|
10
17
|
rna_transcription("T", "A").
|
11
18
|
|
12
|
-
test(rna_complement_of_adenine_is_uracil) :-
|
19
|
+
test(rna_complement_of_adenine_is_uracil, condition(pending)) :-
|
13
20
|
rna_transcription("A", "U").
|
14
21
|
|
15
|
-
test(rna_complement) :-
|
22
|
+
test(rna_complement, condition(pending)) :-
|
16
23
|
rna_transcription("ACGTGGTCTTAA", "UGCACCAGAAUU").
|
17
24
|
|
18
|
-
test(dna_correctly_handles_invalid_input, [fail]) :-
|
25
|
+
test(dna_correctly_handles_invalid_input, [fail, condition(pending)]) :-
|
19
26
|
rna_transcription("U", _).
|
20
27
|
|
21
|
-
test(dna_correctly_handles_completely_invalid_input, [fail]) :-
|
28
|
+
test(dna_correctly_handles_completely_invalid_input, [fail, condition(pending)]) :-
|
22
29
|
rna_transcription("XXX", _).
|
23
30
|
|
24
|
-
test(dna_correctly_handles_partially_invalid_input, [fail]) :-
|
31
|
+
test(dna_correctly_handles_partially_invalid_input, [fail, condition(pending)]) :-
|
25
32
|
rna_transcription("ACGTXXXCTTAA", _).
|
26
33
|
|
27
34
|
:- end_tests(rna_transcription).
|
@@ -1,37 +1,43 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(space_age).
|
2
8
|
|
3
9
|
float_eq(Real, Expected) :-
|
4
10
|
Expected is round(Real * 100).
|
5
11
|
|
6
|
-
test(earth) :-
|
12
|
+
test(earth, condition(true)) :-
|
7
13
|
space_age("Earth", 1000000000, Age),
|
8
14
|
float_eq(Age, 3169).
|
9
15
|
|
10
|
-
test(mercury) :-
|
16
|
+
test(mercury, condition(pending)) :-
|
11
17
|
space_age("Mercury", 2134835688, Age),
|
12
18
|
float_eq(Age, 28088).
|
13
19
|
|
14
|
-
test(venus) :-
|
20
|
+
test(venus, condition(pending)) :-
|
15
21
|
space_age("Venus", 189839836, Age),
|
16
22
|
float_eq(Age, 978).
|
17
23
|
|
18
|
-
test(mars) :-
|
24
|
+
test(mars, condition(pending)) :-
|
19
25
|
space_age("Mars", 2329871239, Age),
|
20
26
|
float_eq(Age, 3925).
|
21
27
|
|
22
|
-
test(jupiter) :-
|
28
|
+
test(jupiter, condition(pending)) :-
|
23
29
|
space_age("Jupiter", 901876382, Age),
|
24
30
|
float_eq(Age, 241).
|
25
31
|
|
26
|
-
test(saturn) :-
|
32
|
+
test(saturn, condition(pending)) :-
|
27
33
|
space_age("Saturn", 3000000000, Age),
|
28
34
|
float_eq(Age, 323).
|
29
35
|
|
30
|
-
test(uranus) :-
|
36
|
+
test(uranus, condition(pending)) :-
|
31
37
|
space_age("Uranus", 3210123456, Age),
|
32
38
|
float_eq(Age, 121).
|
33
39
|
|
34
|
-
test(neptune) :-
|
40
|
+
test(neptune, condition(pending)) :-
|
35
41
|
space_age("Neptune", 8210123456, Age),
|
36
42
|
float_eq(Age, 158).
|
37
43
|
|
@@ -1,39 +1,46 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(sum_of_multiples).
|
2
8
|
|
3
|
-
test(low_limit) :-
|
4
|
-
sum_of_multiples([3, 5], 1,
|
9
|
+
test(low_limit, condition(true)) :-
|
10
|
+
sum_of_multiples([3, 5], 1, Result),
|
11
|
+
Result == 0.
|
5
12
|
|
6
|
-
test(just_one_multiple) :-
|
13
|
+
test(just_one_multiple, condition(pending)) :-
|
7
14
|
sum_of_multiples([3, 5], 4, 3).
|
8
15
|
|
9
|
-
test(a_few_multiples) :-
|
16
|
+
test(a_few_multiples, condition(pending)) :-
|
10
17
|
sum_of_multiples([3, 5], 10, 23).
|
11
18
|
|
12
|
-
test(sum_more_multiples) :-
|
19
|
+
test(sum_more_multiples, condition(pending)) :-
|
13
20
|
sum_of_multiples([3, 5], 100, 2318).
|
14
21
|
|
15
|
-
test(even_more_multiples) :-
|
22
|
+
test(even_more_multiples, condition(pending)) :-
|
16
23
|
sum_of_multiples([3, 5], 1000, 233168).
|
17
24
|
|
18
|
-
test(new_factors) :-
|
25
|
+
test(new_factors, condition(pending)) :-
|
19
26
|
sum_of_multiples([7, 13, 17], 20, 51).
|
20
27
|
|
21
|
-
test(sum_more_new_factors) :-
|
28
|
+
test(sum_more_new_factors, condition(pending)) :-
|
22
29
|
sum_of_multiples([4, 6], 15, 30).
|
23
30
|
|
24
|
-
test(even_more_new_factors) :-
|
31
|
+
test(even_more_new_factors, condition(pending)) :-
|
25
32
|
sum_of_multiples([5, 6, 8], 150, 4419).
|
26
33
|
|
27
|
-
test(divisible_factor) :-
|
34
|
+
test(divisible_factor, condition(pending)) :-
|
28
35
|
sum_of_multiples([5, 25], 51, 275).
|
29
36
|
|
30
|
-
test(large_factors) :-
|
37
|
+
test(large_factors, condition(pending)) :-
|
31
38
|
sum_of_multiples([43, 47], 10000, 2203160).
|
32
39
|
|
33
|
-
test(every_num) :-
|
40
|
+
test(every_num, condition(pending)) :-
|
34
41
|
sum_of_multiples([1], 100, 4950).
|
35
42
|
|
36
|
-
test(no_factors) :-
|
43
|
+
test(no_factors, condition(pending)) :-
|
37
44
|
sum_of_multiples([], 10000, 0).
|
38
45
|
|
39
46
|
:- end_tests(sum_of_multiples).
|
@@ -1,45 +1,52 @@
|
|
1
|
+
pending :-
|
2
|
+
current_prolog_flag(argv, ['--all'|_]).
|
3
|
+
pending :-
|
4
|
+
write('\nA TEST IS PENDING!\n'),
|
5
|
+
fail.
|
6
|
+
|
1
7
|
:- begin_tests(triangle).
|
2
8
|
|
3
|
-
test(equilateral_triangle_has_all_sides_equal) :-
|
4
|
-
triangle(2, 2, 2,
|
9
|
+
test(equilateral_triangle_has_all_sides_equal, condition(true)) :-
|
10
|
+
triangle(2, 2, 2, Result),
|
11
|
+
Result == "equilateral".
|
5
12
|
|
6
|
-
test(larger_equilateral_triangle) :-
|
13
|
+
test(larger_equilateral_triangle, condition(pending)) :-
|
7
14
|
triangle(10, 10, 10, "equilateral").
|
8
15
|
|
9
|
-
test(isosceles_triangle_with_last_two_sides_equal) :-
|
16
|
+
test(isosceles_triangle_with_last_two_sides_equal, condition(pending)) :-
|
10
17
|
triangle(3, 4, 4, "isosceles").
|
11
18
|
|
12
|
-
test(isosceles_triangle_with_first_two_sides_equal) :-
|
19
|
+
test(isosceles_triangle_with_first_two_sides_equal, condition(pending)) :-
|
13
20
|
triangle(4, 4, 3, "isosceles").
|
14
21
|
|
15
|
-
test(isosceles_triangle_with_first_and_last_sides_equal) :-
|
22
|
+
test(isosceles_triangle_with_first_and_last_sides_equal, condition(pending)) :-
|
16
23
|
triangle(4, 3, 4, "isosceles").
|
17
24
|
|
18
|
-
test(isosceles_triangle_with_unequal_side_larger_than_equal_sides) :-
|
25
|
+
test(isosceles_triangle_with_unequal_side_larger_than_equal_sides, condition(pending)) :-
|
19
26
|
triangle(4, 7, 4, "isosceles").
|
20
27
|
|
21
|
-
test(scalene_triangle_has_no_equal_sides) :-
|
28
|
+
test(scalene_triangle_has_no_equal_sides, condition(pending)) :-
|
22
29
|
triangle(3, 4, 5, "scalene").
|
23
30
|
|
24
|
-
test(a2_equals_b_plus_c_isnt_always_equilateral) :-
|
31
|
+
test(a2_equals_b_plus_c_isnt_always_equilateral, condition(pending)) :-
|
25
32
|
triangle(5, 4, 6, "scalene").
|
26
33
|
|
27
|
-
test(larger_scalene_triangle) :-
|
34
|
+
test(larger_scalene_triangle, condition(pending)) :-
|
28
35
|
triangle(10, 11, 12, "scalene").
|
29
36
|
|
30
|
-
test(scalene_triangle_with_sides_in_descending_order) :-
|
37
|
+
test(scalene_triangle_with_sides_in_descending_order, condition(pending)) :-
|
31
38
|
triangle(5, 4, 2, "scalene").
|
32
39
|
|
33
|
-
test(small_scalene_triangle_with_floating_point_values) :-
|
40
|
+
test(small_scalene_triangle_with_floating_point_values, condition(pending)) :-
|
34
41
|
triangle((0.4), (0.6), (0.3), "scalene").
|
35
42
|
|
36
|
-
test(a_triangle_violating_the_triangle_inequality_is_illegal, [fail]) :-
|
43
|
+
test(a_triangle_violating_the_triangle_inequality_is_illegal, [fail, condition(pending)]) :-
|
37
44
|
triangle(7, 3, 2, _).
|
38
45
|
|
39
|
-
test(two_sides_equal_but_violates_triangle_inequality, [fail]) :-
|
46
|
+
test(two_sides_equal_but_violates_triangle_inequality, [fail, condition(pending)]) :-
|
40
47
|
triangle(1, 1, 3, _).
|
41
48
|
|
42
|
-
test(triangles_with_all_sides_zero_are_illegal, [fail]) :-
|
49
|
+
test(triangles_with_all_sides_zero_are_illegal, [fail, condition(pending)]) :-
|
43
50
|
triangle(0, 0, 0, _).
|
44
51
|
|
45
52
|
:- end_tests(triangle).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
@@ -5180,7 +5180,6 @@ files:
|
|
5180
5180
|
- tracks/prolog/docs/LEARNING.md
|
5181
5181
|
- tracks/prolog/docs/RESOURCES.md
|
5182
5182
|
- tracks/prolog/docs/TESTS.md
|
5183
|
-
- tracks/prolog/exercises/.keep
|
5184
5183
|
- tracks/prolog/exercises/anagram/anagram.example
|
5185
5184
|
- tracks/prolog/exercises/anagram/anagram.pl
|
5186
5185
|
- tracks/prolog/exercises/anagram/anagram_tests.plt
|
File without changes
|