diff options
author | Aleš Smodiš <aless@guru.si> | 2015-08-18 16:06:19 +0200 |
---|---|---|
committer | Aleš Smodiš <aless@guru.si> | 2015-08-18 16:06:19 +0200 |
commit | 95e2fe57f6e4639f6ae9f1fef368829d5090dbf6 (patch) | |
tree | 462ba05eb0c4732ca1c97739548801258bf47b40 /prolog/problems/license_plates/getdigits_2 |
Exported all problems from the SQLite database into the new directory structure.
Diffstat (limited to 'prolog/problems/license_plates/getdigits_2')
-rw-r--r-- | prolog/problems/license_plates/getdigits_2/common.py | 14 | ||||
-rw-r--r-- | prolog/problems/license_plates/getdigits_2/en.py | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/prolog/problems/license_plates/getdigits_2/common.py b/prolog/problems/license_plates/getdigits_2/common.py new file mode 100644 index 0000000..8d6e890 --- /dev/null +++ b/prolog/problems/license_plates/getdigits_2/common.py @@ -0,0 +1,14 @@ +id = 144 +group = 'license_plates' +number = 51 +visible = True +facts = None + +solution = '''\ +getdigits([], []). +getdigits([X|T], [X|NT]) :- + number(X), !, + getdigits(T, NT). +getdigits([_|T], NT) :- + getdigits(T, NT). +''' diff --git a/prolog/problems/license_plates/getdigits_2/en.py b/prolog/problems/license_plates/getdigits_2/en.py new file mode 100644 index 0000000..06bfa22 --- /dev/null +++ b/prolog/problems/license_plates/getdigits_2/en.py @@ -0,0 +1,12 @@ +id = 144 +name = 'getdigits/2' +slug = 'remove non-numeric elements from a list' + +description = '''\ +<p><code>getdigits(L, DL)</code>: the list <code>DL</code> contains the numeric elements of <code>L</code>, in the same order as in the original list.</p> +<pre> + ?- getdigits([2,3,e,-,4,b], DL). + DL = [2,3,4]. +</pre>''' + +hint = {} |