summaryrefslogtreecommitdiff
path: root/prolog/problems/lists/memb_2
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-08-18 16:06:19 +0200
committerAleš Smodiš <aless@guru.si>2015-08-18 16:06:19 +0200
commit95e2fe57f6e4639f6ae9f1fef368829d5090dbf6 (patch)
tree462ba05eb0c4732ca1c97739548801258bf47b40 /prolog/problems/lists/memb_2
Exported all problems from the SQLite database into the new directory structure.
Diffstat (limited to 'prolog/problems/lists/memb_2')
-rw-r--r--prolog/problems/lists/memb_2/common.py11
-rw-r--r--prolog/problems/lists/memb_2/en.py16
2 files changed, 27 insertions, 0 deletions
diff --git a/prolog/problems/lists/memb_2/common.py b/prolog/problems/lists/memb_2/common.py
new file mode 100644
index 0000000..32d9125
--- /dev/null
+++ b/prolog/problems/lists/memb_2/common.py
@@ -0,0 +1,11 @@
+id = 103
+group = 'lists'
+number = 10
+visible = True
+facts = None
+
+solution = '''\
+memb(X, [X|_]).
+memb(X, [_|T]) :-
+ memb(X, T).
+'''
diff --git a/prolog/problems/lists/memb_2/en.py b/prolog/problems/lists/memb_2/en.py
new file mode 100644
index 0000000..fca82b7
--- /dev/null
+++ b/prolog/problems/lists/memb_2/en.py
@@ -0,0 +1,16 @@
+id = 103
+name = 'memb/2'
+slug = 'find elements in list'
+
+description = '''\
+<p><code>memb(M, L)</code>: <code>M</code> is an element of list <code>L</code>.</p>
+<pre>
+ ?- memb(X, [1,2,3]).
+ X = 1 ;
+ X = 2 ;
+ X = 3.
+ ?- memb(1, [3,2,X]).
+ X = 1.
+</pre>'''
+
+hint = {}