I want to multiply the elements of 2 lists in scheme and save the result of each multiplication in a third list that is returned by a function
and.. the lists will always have the same size
The idea in python is this
def multi_elements( l1, l2):
save = []
for i in range(len(l1)):
save.append(l1[i] * l2[i])
return save
a = [ 1, 2 ,3]
b = [ 2, 3 ,4]
c = multi_elements(a, b)
print("C= ",c)
=>C= [2, 6 ,12]
I want to do the same, but in scheme in a function called the same i only has 3 days learning scheme
(def (multi-elements list1 list2)
....
)
any suggestions?
Since we will go until the
l1
is exhausted and with no regards to the length of thel2
in the Python version, I would suggest the following implementation in Scheme:For example: