Skip to content

Instantly share code, notes, and snippets.

@DonaldKellett
Created December 22, 2018 17:07
Show Gist options
  • Save DonaldKellett/c0a2c53dda0a9d7ea1c33af42aaf328e to your computer and use it in GitHub Desktop.
Save DonaldKellett/c0a2c53dda0a9d7ea1c33af42aaf328e to your computer and use it in GitHub Desktop.
Learn Prolog Now! - Chapter 5 - Practical Session - Programming Exercise 3 - Dot product of 2 vectors
dot([], [], 0).
dot([X | V1], [Y | V2], Z) :- dot(V1, V2, Result), Z is X * Y + Result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment