summaryrefslogtreecommitdiff
path: root/prolog/problems/sets/is_superset_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/sets/is_superset_2
Exported all problems from the SQLite database into the new directory structure.
Diffstat (limited to 'prolog/problems/sets/is_superset_2')
-rw-r--r--prolog/problems/sets/is_superset_2/common.py16
-rw-r--r--prolog/problems/sets/is_superset_2/en.py14
2 files changed, 30 insertions, 0 deletions
diff --git a/prolog/problems/sets/is_superset_2/common.py b/prolog/problems/sets/is_superset_2/common.py
new file mode 100644
index 0000000..364c513
--- /dev/null
+++ b/prolog/problems/sets/is_superset_2/common.py
@@ -0,0 +1,16 @@
+id = 131
+group = 'sets'
+number = 38
+visible = True
+facts = None
+
+solution = '''\
+memb131(X, [X|_]).
+memb131(X, [_|T]) :-
+ memb131(X, T).
+
+is_superset(_, []).
+is_superset(S1, [H|T]) :-
+ memb131(H, S1),
+ is_superset(S1, T).
+'''
diff --git a/prolog/problems/sets/is_superset_2/en.py b/prolog/problems/sets/is_superset_2/en.py
new file mode 100644
index 0000000..218c0c8
--- /dev/null
+++ b/prolog/problems/sets/is_superset_2/en.py
@@ -0,0 +1,14 @@
+id = 131
+name = 'is_superset/2'
+slug = 'check if one set is a superset of the other'
+
+description = '''\
+<p><code>is_superset(S1, S2)</code>: the set <code>S1</code> is a superset (contains all elements) of <code>S2</code>.</p>
+<pre>
+ ?- is_superset([3,2,1,4,5,9], [2,1,3,5]).
+ true.
+ ?- is_superset([3,2,1,4,5,9], [2,1,3,5,0]).
+ false.
+</pre>'''
+
+hint = {}