summaryrefslogtreecommitdiff
path: root/prolog/problems/lists/del_3
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/lists/del_3')
-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)