reset password
Author Message
rabbott
Posts: 1649
Posted 14:21 Apr 25, 2019 |

I have cleaned up and simplified the prolog-in-python code, added new comments, removed Piumarta's tutorial comments, which you can find on his slides, and most interestingly, added append/3. It is capable of doing append in "both directions."

> append([0, 1], [2, 3, 4], Z)
Z = [0, 1, 2, 3, 4])

> append(X, Y, [0, 1, 2, 3, 4])
X = []
Y = [0, 1, 2, 3, 4]

X = [0]
Y = [1, 2, 3, 4]

X = [0, 1]
Y = [2, 3, 4]

X = [0, 1, 2]
Y = [3, 4]

X = [0, 1, 2, 3]
Y = [4]

X = [0, 1, 2, 3, 4]
Y = []

If anyone is interested we can talk about how the code works (it really does make sense, and it's not too difficult to understand) if we run out of review questions to talk about.