Created
December 22, 2018 16:59
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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