From 185990bb4435b23e50464125ecaf84f8aeae766d Mon Sep 17 00:00:00 2001
From: Aleksander Sadikov
Recursive step: if we assume NewTail
is the tail with already inserted element X
,
-then [H|NewTail]
is the whole list with the element X
inserted.
[H|NewTail]
is the whole list with element X
inserted.
''']
hint = {
@@ -79,7 +79,7 @@ or something similarly impossible).
The element has been successfully inserted, but all the others before it are lost, right? Did you forget to put the head back at the front of the list after returning from recursion?
-Try asking prolog the following query and check all the solutions:
+Try asking the following query and check all the solutions:
?- insert(q, [a,b,c,d], L).