4 ms·
Prolog's unification: X = Y, X = 5, %% Y = 5 now as well -- ?- append([1,2], Y, [1,2,3]). Y = [3].
by icebraining 9y ago
Prolog's unification:
X = Y,
X = 5,
%% Y = 5 now as well
--
?- append([1,2], Y, [1,2,3]).
Y = [3].
- OskarS 9y agoYeah, Prolog's unification operator really blows your mind the first few times you experience it. You left the best part out of that last example: ?- append(X, Y, [1,2,3]). X = [], Y = [1, 2, 3] ; X = [1], Y = [2, 3] ; X = [1, 2], Y = [3] ; X = [1, 2, 3], Y = [] ; false. (a few newlines added for clarity)