summaryrefslogtreecommitdiff
path: root/prolog/problems/lists
diff options
context:
space:
mode:
authorAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-03-09 20:42:22 +0100
committerAleksander Sadikov <aleksander.sadikov@fri.uni-lj.si>2016-03-09 20:42:22 +0100
commitdbbca6aaf0fa33c6ae152cc361a05522776f5a72 (patch)
treef9e98e49660867125b50a077f8785d057f8ca66e /prolog/problems/lists
parentd1565072c4d1eefcaf294bebfdb9ce1a3d299485 (diff)
Hints for del/3 updated.
Diffstat (limited to 'prolog/problems/lists')
-rw-r--r--prolog/problems/lists/del_3/common.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/prolog/problems/lists/del_3/common.py b/prolog/problems/lists/del_3/common.py
index 65c51d1..deadbf8 100644
--- a/prolog/problems/lists/del_3/common.py
+++ b/prolog/problems/lists/del_3/common.py
@@ -97,7 +97,9 @@ def hint(code, aux_code):
return [{'id': 'lost_heads'}]
# used [X|T] instead of more general [H|T] in recursive case
- if prolog.engine.ask_truth(engine_id, 'del(q, [a,b,c,d,q,x,y,z], [x,y,z])'):
+ if prolog.engine.ask_truth(engine_id, \
+ 'findall(NL, del(q, [q,q,q,a,b,c], NL), [[q,q,a,b,c],[q,q,a,b,c],[q,q,a,b,c]]).') and \
+ not prolog.engine.ask_truth(engine_id, 'del(q, [a,b,c,q,x,y,z], [a,b,c,x,y,z])'):
return [{'id': 'leading_heads_all_x'}]
# L=[H|T] at the end of the rule; this can be detected with test cases and can be wrong (in some sense)