Skip to content

Instantly share code, notes, and snippets.

@DonaldKellett
Created December 22, 2018 16:59
Show Gist options
  • Save DonaldKellett/5abada7f04715766d15e271689c35f84 to your computer and use it in GitHub Desktop.
Save DonaldKellett/5abada7f04715766d15e271689c35f84 to your computer and use it in GitHub Desktop.
Learn Prolog Now! - Chapter 5 - Practical Session - Programming Exercise 2 - Scalar multiplication of vectors
scalarMult(_, [], []).
scalarMult(C, [X | T], [Y | Result]) :- Y is C * X, scalarMult(C, T, Result).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment