325nH1) Could you please help me to solve this problem? Write the following ML f
ID: 3932886 • Letter: 3
Question
325nH1) Could you please help me to solve this problem?
Write the following ML function: (ONLY WITH METALANGUAGE, ML)
Write a function which takes two integer list parameters and if they are of equal size, finds the product of all elements in both lists. Otherwise, the function should return 0.
Note: Write only one function.
Sample Run:
- mult([4,8,2],[1,2,5]); //Product of 4,8,2,1,2,5 is 640
val it = 640 : int
- mult([4,8],[1,2,5]); //different lengths
val it = 0 : int
- mult([4,8,2,9],[1,2,5]); //different lengths
val it = 0 : int
Explanation / Answer
Note: Run the code without missing the intendation.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.