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/sets/subset_2 |
Exported all problems from the SQLite database into the new directory structure.
Diffstat (limited to 'prolog/problems/sets/subset_2')
-rw-r--r-- | prolog/problems/sets/subset_2/common.py | 13 | ||||
-rw-r--r-- | prolog/problems/sets/subset_2/en.py | 19 |
2 files changed, 32 insertions, 0 deletions
diff --git a/prolog/problems/sets/subset_2/common.py b/prolog/problems/sets/subset_2/common.py new file mode 100644 index 0000000..7fbbf49 --- /dev/null +++ b/prolog/problems/sets/subset_2/common.py @@ -0,0 +1,13 @@ +id = 133 +group = 'sets' +number = 40 +visible = True +facts = None + +solution = '''\ +subset([], []). +subset([H|T], [H|T1]) :- + subset(T, T1). +subset([_|T], T1) :- + subset(T, T1). +''' diff --git a/prolog/problems/sets/subset_2/en.py b/prolog/problems/sets/subset_2/en.py new file mode 100644 index 0000000..9d9132b --- /dev/null +++ b/prolog/problems/sets/subset_2/en.py @@ -0,0 +1,19 @@ +id = 133 +name = 'subset/2' +slug = 'generate all subsets of a set' + +description = '''\ +<p><code>subset(Set, Subset)</code>: the set <code>Subset</code> is a subset of <code>Set</code>. This predicate should generate all valid solutions, one by one.</p> +<pre> + ?- subset([1,2,3], SS). + SS = [1,2,3] ; + SS = [1,2] ; + SS = [1,3] ; + SS = [1] ; + SS = [2,3] ; + SS = [2] ; + SS = [3] ; + SS = []. +</pre>''' + +hint = {} |