summaryrefslogtreecommitdiff
path: root/prolog/problems/license_plates/getdigits_2
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/license_plates/getdigits_2')
-rw-r--r--prolog/problems/license_plates/getdigits_2/common.py14
-rw-r--r--prolog/problems/license_plates/getdigits_2/en.py12
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 = {}