diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-09 01:39:55 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2016-03-09 01:39:55 +0100 |
commit | c61d06eab2c15928a928fcea106f276013902bb0 (patch) | |
tree | b378f05c4a427b3ee619d852d7c6543f23dedbe2 /prolog/problems/lists/memb_2 | |
parent | e22d05a916d50896ea6d8b52b3a3ac9596e8f12b (diff) |
Hints for memb/2 added.
Diffstat (limited to 'prolog/problems/lists/memb_2')
-rw-r--r-- | prolog/problems/lists/memb_2/common.py | 10 | ||||
-rw-r--r-- | prolog/problems/lists/memb_2/sl.py | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/prolog/problems/lists/memb_2/common.py b/prolog/problems/lists/memb_2/common.py index 4f2a251..45e070a 100644 --- a/prolog/problems/lists/memb_2/common.py +++ b/prolog/problems/lists/memb_2/common.py @@ -72,14 +72,14 @@ def hint(code, aux_code): # recursion is getting bigger and bigger - # target predicate seems to always be false - if not prolog.engine.ask_truth(engine_id, 'memb(_, _)'): - return [{'id': 'predicate_always_false'}] - # missing/failed base case - if not prolog.engine.ask_truthTO(engine_id, 'memb(qq, [qq|_])'): + if not prolog.engine.ask_truthTO(engine_id, 'memb(qq, [qq,_,_,_])'): return [{'id': 'base_case'}] + # target predicate seems to always be false + if not prolog.engine.ask_truth(engine_id, 'memb(_, [_,_,_,_,_,_])'): + return [{'id': 'predicate_always_false'}] + # TODO: Tim, can we include 'fail'-used as a general hint? except socket.timeout as ex: diff --git a/prolog/problems/lists/memb_2/sl.py b/prolog/problems/lists/memb_2/sl.py index 5b44521..f2d0ce2 100644 --- a/prolog/problems/lists/memb_2/sl.py +++ b/prolog/problems/lists/memb_2/sl.py @@ -30,7 +30,7 @@ hint = { 'eq_instead_of_equ': '''\ <p>Operator <code>==</code> je strožji od operatorja <code>=</code> v smislu, da je za slednjega dovolj, da elementa lahko naredi enaka (unifikacija). Morda z uporabo <code>=</code> narediš predikat -<code>member/2</code> delujoč tudi v kakšni drugi smeri.</p> +<code>memb/2</code> delujoč tudi v kakšni drugi smeri.</p> ''', 'eq_instead_of_equ_markup': '''\ |