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/lists/del_3 |
Exported all problems from the SQLite database into the new directory structure.
Diffstat (limited to 'prolog/problems/lists/del_3')
-rw-r--r-- | prolog/problems/lists/del_3/common.py | 11 | ||||
-rw-r--r-- | prolog/problems/lists/del_3/en.py | 19 |
2 files changed, 30 insertions, 0 deletions
diff --git a/prolog/problems/lists/del_3/common.py b/prolog/problems/lists/del_3/common.py new file mode 100644 index 0000000..1e99959 --- /dev/null +++ b/prolog/problems/lists/del_3/common.py @@ -0,0 +1,11 @@ +id = 105 +group = 'lists' +number = 11 +visible = True +facts = None + +solution = '''\ +del(X, [X|T], T). +del(X, [Y|T], [Y|L]) :- + del(X, T, L). +''' diff --git a/prolog/problems/lists/del_3/en.py b/prolog/problems/lists/del_3/en.py new file mode 100644 index 0000000..a0f0cd3 --- /dev/null +++ b/prolog/problems/lists/del_3/en.py @@ -0,0 +1,19 @@ +id = 105 +name = 'del/3' +slug = 'delete an element from list' + +description = '''\ +<p><code>del(X, L1, L2)</code>: the list <code>L2</code> is obtained from <code>L1</code> by deleting element <code>X</code>.</p> +<pre> + ?- del(1, [1,2,3], L). + L = [2,3]. + ?- del(2, [1,2,3,2,5], L). + L = [1,3,2,5] ; + L = [1,2,3,5]. + ?- del(X, [1,2,3], L). + X = 1, L = [2,3] ; + X = 2, L = [1,3] ; + X = 3, L = [1,2]. +</pre>''' + +hint = {} |