Download code

Jump to: navigation, search

Back to Scalar_multiplication_(Prolog)

Download for Windows: zip

Download for UNIX: zip, tar.gz, tar.bz2

vscale.pl

1 vscale([], _, []).
2 vscale([H1|T1], X, [H2|T2]) :-
3     H2 is X * H1,
4     vscale(T1, X, T2).
5 


mscale.pl

1 mscale([], _, []).
2 mscale([H1|T1], X, [H2|T2]) :-
3     vscale(H1, X, H2),
4     mscale(T1, X, T2).