SlideShare a Scribd company logo
write Ocaml programe to add all numbers in a list ?
the solution :
let rec sum list =
match list with
[ ] -> 0
| x:: tail -> x + (sum tail);;
let a = [2;4;5;6;1;9;10 ];;
sum a;;
question is :-Write a Ocaml Program to multiply each element in a list by 2. a= [2;4;5;6;1;9;10 ]
Solution
let rec intmult : int list * int -> int list =
function ([],_) -> [0]
| ([x] ,al) -> [x * al]
| (x::xs,al) -> x * al :: intmult (xs, al);;
Also, you can use the map function as I mentioned below,
let intmult (l,m)= List.map (fun x -> x * m) l

More Related Content

More from rajeshjangid1865 (20)

Suppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdf
Suppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdfSuppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdf
Suppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdf
rajeshjangid1865
 
Specialized regions on the cell surface through which cells are joine.pdf
Specialized regions on the cell surface through which cells are joine.pdfSpecialized regions on the cell surface through which cells are joine.pdf
Specialized regions on the cell surface through which cells are joine.pdf
rajeshjangid1865
 
Section 404 of the Sarbanes Oxley Act requires auditors of a public .pdf
Section 404 of the Sarbanes Oxley Act requires auditors of a public .pdfSection 404 of the Sarbanes Oxley Act requires auditors of a public .pdf
Section 404 of the Sarbanes Oxley Act requires auditors of a public .pdf
rajeshjangid1865
 
Reiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdf
Reiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdfReiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdf
Reiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdf
rajeshjangid1865
 
Problem 2-1A Suppose the following items are taken from the 2017 bala.pdf
Problem 2-1A Suppose the following items are taken from the 2017 bala.pdfProblem 2-1A Suppose the following items are taken from the 2017 bala.pdf
Problem 2-1A Suppose the following items are taken from the 2017 bala.pdf
rajeshjangid1865
 
Prepare a 2017 income statement for Shanta Corporation based on the f.pdf
Prepare a 2017 income statement for Shanta Corporation based on the f.pdfPrepare a 2017 income statement for Shanta Corporation based on the f.pdf
Prepare a 2017 income statement for Shanta Corporation based on the f.pdf
rajeshjangid1865
 
Organizations need to have a pool of managerial talent to take on jo.pdf
Organizations need to have a pool of managerial talent to take on jo.pdfOrganizations need to have a pool of managerial talent to take on jo.pdf
Organizations need to have a pool of managerial talent to take on jo.pdf
rajeshjangid1865
 
Objective Manipulate the Linked List Pointer.Make acopy of LList..pdf
Objective Manipulate the Linked List Pointer.Make acopy of LList..pdfObjective Manipulate the Linked List Pointer.Make acopy of LList..pdf
Objective Manipulate the Linked List Pointer.Make acopy of LList..pdf
rajeshjangid1865
 
Militarism Alliances Imperialism Nationalism Class, the powder keg.pdf
Militarism Alliances Imperialism Nationalism Class, the powder keg.pdfMilitarism Alliances Imperialism Nationalism Class, the powder keg.pdf
Militarism Alliances Imperialism Nationalism Class, the powder keg.pdf
rajeshjangid1865
 
In the subject of cryptography, what policy or organizational challe.pdf
In the subject of cryptography, what policy or organizational challe.pdfIn the subject of cryptography, what policy or organizational challe.pdf
In the subject of cryptography, what policy or organizational challe.pdf
rajeshjangid1865
 
is Google making us stupid Nicholas Carr Summarize Article. https.pdf
is Google making us stupid Nicholas Carr Summarize Article. https.pdfis Google making us stupid Nicholas Carr Summarize Article. https.pdf
is Google making us stupid Nicholas Carr Summarize Article. https.pdf
rajeshjangid1865
 
If the environment of propagation has be th specular and scattering c.pdf
If the environment of propagation has be th specular and scattering c.pdfIf the environment of propagation has be th specular and scattering c.pdf
If the environment of propagation has be th specular and scattering c.pdf
rajeshjangid1865
 
iments undertaken at Oxford University in Great only when both allee .pdf
iments undertaken at Oxford University in Great only when both allee .pdfiments undertaken at Oxford University in Great only when both allee .pdf
iments undertaken at Oxford University in Great only when both allee .pdf
rajeshjangid1865
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
rajeshjangid1865
 
how much and to whom do business people listenyour taskintervie.pdf
how much and to whom do business people listenyour taskintervie.pdfhow much and to whom do business people listenyour taskintervie.pdf
how much and to whom do business people listenyour taskintervie.pdf
rajeshjangid1865
 
Google recently introduced the Android Wear, a smartwatch line based.pdf
Google recently introduced the Android Wear, a smartwatch line based.pdfGoogle recently introduced the Android Wear, a smartwatch line based.pdf
Google recently introduced the Android Wear, a smartwatch line based.pdf
rajeshjangid1865
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
rajeshjangid1865
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
rajeshjangid1865
 
Assume an HTTP client that wishes to obtain a Web document located a.pdf
Assume an HTTP client that wishes to obtain a Web document located a.pdfAssume an HTTP client that wishes to obtain a Web document located a.pdf
Assume an HTTP client that wishes to obtain a Web document located a.pdf
rajeshjangid1865
 
Answer questions based on the company UBER. Who was the investment .pdf
Answer questions based on the company UBER. Who was the investment .pdfAnswer questions based on the company UBER. Who was the investment .pdf
Answer questions based on the company UBER. Who was the investment .pdf
rajeshjangid1865
 
Suppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdf
Suppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdfSuppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdf
Suppose 1.01g of FeCl3 is placed in a 10.0ml volumetric glass, water.pdf
rajeshjangid1865
 
Specialized regions on the cell surface through which cells are joine.pdf
Specialized regions on the cell surface through which cells are joine.pdfSpecialized regions on the cell surface through which cells are joine.pdf
Specialized regions on the cell surface through which cells are joine.pdf
rajeshjangid1865
 
Section 404 of the Sarbanes Oxley Act requires auditors of a public .pdf
Section 404 of the Sarbanes Oxley Act requires auditors of a public .pdfSection 404 of the Sarbanes Oxley Act requires auditors of a public .pdf
Section 404 of the Sarbanes Oxley Act requires auditors of a public .pdf
rajeshjangid1865
 
Reiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdf
Reiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdfReiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdf
Reiji and Tuneko Okazaki conducted a now classic experiment in 1968 .pdf
rajeshjangid1865
 
Problem 2-1A Suppose the following items are taken from the 2017 bala.pdf
Problem 2-1A Suppose the following items are taken from the 2017 bala.pdfProblem 2-1A Suppose the following items are taken from the 2017 bala.pdf
Problem 2-1A Suppose the following items are taken from the 2017 bala.pdf
rajeshjangid1865
 
Prepare a 2017 income statement for Shanta Corporation based on the f.pdf
Prepare a 2017 income statement for Shanta Corporation based on the f.pdfPrepare a 2017 income statement for Shanta Corporation based on the f.pdf
Prepare a 2017 income statement for Shanta Corporation based on the f.pdf
rajeshjangid1865
 
Organizations need to have a pool of managerial talent to take on jo.pdf
Organizations need to have a pool of managerial talent to take on jo.pdfOrganizations need to have a pool of managerial talent to take on jo.pdf
Organizations need to have a pool of managerial talent to take on jo.pdf
rajeshjangid1865
 
Objective Manipulate the Linked List Pointer.Make acopy of LList..pdf
Objective Manipulate the Linked List Pointer.Make acopy of LList..pdfObjective Manipulate the Linked List Pointer.Make acopy of LList..pdf
Objective Manipulate the Linked List Pointer.Make acopy of LList..pdf
rajeshjangid1865
 
Militarism Alliances Imperialism Nationalism Class, the powder keg.pdf
Militarism Alliances Imperialism Nationalism Class, the powder keg.pdfMilitarism Alliances Imperialism Nationalism Class, the powder keg.pdf
Militarism Alliances Imperialism Nationalism Class, the powder keg.pdf
rajeshjangid1865
 
In the subject of cryptography, what policy or organizational challe.pdf
In the subject of cryptography, what policy or organizational challe.pdfIn the subject of cryptography, what policy or organizational challe.pdf
In the subject of cryptography, what policy or organizational challe.pdf
rajeshjangid1865
 
is Google making us stupid Nicholas Carr Summarize Article. https.pdf
is Google making us stupid Nicholas Carr Summarize Article. https.pdfis Google making us stupid Nicholas Carr Summarize Article. https.pdf
is Google making us stupid Nicholas Carr Summarize Article. https.pdf
rajeshjangid1865
 
If the environment of propagation has be th specular and scattering c.pdf
If the environment of propagation has be th specular and scattering c.pdfIf the environment of propagation has be th specular and scattering c.pdf
If the environment of propagation has be th specular and scattering c.pdf
rajeshjangid1865
 
iments undertaken at Oxford University in Great only when both allee .pdf
iments undertaken at Oxford University in Great only when both allee .pdfiments undertaken at Oxford University in Great only when both allee .pdf
iments undertaken at Oxford University in Great only when both allee .pdf
rajeshjangid1865
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
rajeshjangid1865
 
how much and to whom do business people listenyour taskintervie.pdf
how much and to whom do business people listenyour taskintervie.pdfhow much and to whom do business people listenyour taskintervie.pdf
how much and to whom do business people listenyour taskintervie.pdf
rajeshjangid1865
 
Google recently introduced the Android Wear, a smartwatch line based.pdf
Google recently introduced the Android Wear, a smartwatch line based.pdfGoogle recently introduced the Android Wear, a smartwatch line based.pdf
Google recently introduced the Android Wear, a smartwatch line based.pdf
rajeshjangid1865
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
rajeshjangid1865
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
rajeshjangid1865
 
Assume an HTTP client that wishes to obtain a Web document located a.pdf
Assume an HTTP client that wishes to obtain a Web document located a.pdfAssume an HTTP client that wishes to obtain a Web document located a.pdf
Assume an HTTP client that wishes to obtain a Web document located a.pdf
rajeshjangid1865
 
Answer questions based on the company UBER. Who was the investment .pdf
Answer questions based on the company UBER. Who was the investment .pdfAnswer questions based on the company UBER. Who was the investment .pdf
Answer questions based on the company UBER. Who was the investment .pdf
rajeshjangid1865
 

Recently uploaded (20)

Quiz-E-Mataram (Under 20 Quiz Set) .pptx
Quiz-E-Mataram (Under 20 Quiz Set) .pptxQuiz-E-Mataram (Under 20 Quiz Set) .pptx
Quiz-E-Mataram (Under 20 Quiz Set) .pptx
SouptikUkil
 
Sri Guru Arjun Dev Ji .
Sri Guru Arjun Dev Ji                   .Sri Guru Arjun Dev Ji                   .
Sri Guru Arjun Dev Ji .
Balvir Singh
 
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
Arshad Shaikh
 
Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...
Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...
Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...
Ibrahim Tareq
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
siemaillard
 
Unit 2 DNS Spoofing in a BadUSB Attack.pdf
Unit 2 DNS Spoofing in a BadUSB Attack.pdfUnit 2 DNS Spoofing in a BadUSB Attack.pdf
Unit 2 DNS Spoofing in a BadUSB Attack.pdf
ChatanBawankar
 
New syllabus entomology (Lession plan 121).pdf
New syllabus entomology (Lession plan 121).pdfNew syllabus entomology (Lession plan 121).pdf
New syllabus entomology (Lession plan 121).pdf
Arshad Shaikh
 
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdf
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdfTechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdf
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdf
TechSoup
 
What are the Features & Functions of Odoo 18 SMS Marketing
What are the Features & Functions of Odoo 18 SMS MarketingWhat are the Features & Functions of Odoo 18 SMS Marketing
What are the Features & Functions of Odoo 18 SMS Marketing
Celine George
 
Policies, procedures, subject selection and QTAC.pptx
Policies, procedures, subject selection and QTAC.pptxPolicies, procedures, subject selection and QTAC.pptx
Policies, procedures, subject selection and QTAC.pptx
mansk2
 
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptxQUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
Sourav Kr Podder
 
Drug Metabolism advanced medicinal chemistry.pptx
Drug Metabolism advanced medicinal chemistry.pptxDrug Metabolism advanced medicinal chemistry.pptx
Drug Metabolism advanced medicinal chemistry.pptx
pharmaworld
 
Writing Research Papers: Guidance for Research Community
Writing Research Papers: Guidance for Research CommunityWriting Research Papers: Guidance for Research Community
Writing Research Papers: Guidance for Research Community
Rishi Bankim Chandra Evening College, Naihati, North 24 Parganas, West Bengal, India
 
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase HughesThe Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
pekokmupei
 
Research Handbook On Environment And Investment Law Kate Miles
Research Handbook On Environment And Investment Law Kate MilesResearch Handbook On Environment And Investment Law Kate Miles
Research Handbook On Environment And Investment Law Kate Miles
mucomousamir
 
QUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptx
QUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptxQUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptx
QUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptx
Sourav Kr Podder
 
Philosophical Basis of Curriculum Designing
Philosophical Basis of Curriculum DesigningPhilosophical Basis of Curriculum Designing
Philosophical Basis of Curriculum Designing
Ankit Choudhary
 
EVALUATION AND MANAGEMENT OF OPEN FRACTURE
EVALUATION AND MANAGEMENT OF OPEN FRACTUREEVALUATION AND MANAGEMENT OF OPEN FRACTURE
EVALUATION AND MANAGEMENT OF OPEN FRACTURE
BipulBorthakur
 
the dynastic history of the Gahadwals of Early Medieval Period
the dynastic history of the Gahadwals of Early Medieval Periodthe dynastic history of the Gahadwals of Early Medieval Period
the dynastic history of the Gahadwals of Early Medieval Period
PrachiSontakke5
 
Education Funding Equity in North Carolina: Looking Beyond Income
Education Funding Equity in North Carolina: Looking Beyond IncomeEducation Funding Equity in North Carolina: Looking Beyond Income
Education Funding Equity in North Carolina: Looking Beyond Income
EducationNC
 
Quiz-E-Mataram (Under 20 Quiz Set) .pptx
Quiz-E-Mataram (Under 20 Quiz Set) .pptxQuiz-E-Mataram (Under 20 Quiz Set) .pptx
Quiz-E-Mataram (Under 20 Quiz Set) .pptx
SouptikUkil
 
Sri Guru Arjun Dev Ji .
Sri Guru Arjun Dev Ji                   .Sri Guru Arjun Dev Ji                   .
Sri Guru Arjun Dev Ji .
Balvir Singh
 
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
"Orthoptera: Grasshoppers, Crickets, and Katydids pptx
Arshad Shaikh
 
Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...
Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...
Patent Law in Bangladesh Addressing Challenges in Pharmaceutical Innovation a...
Ibrahim Tareq
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
siemaillard
 
Unit 2 DNS Spoofing in a BadUSB Attack.pdf
Unit 2 DNS Spoofing in a BadUSB Attack.pdfUnit 2 DNS Spoofing in a BadUSB Attack.pdf
Unit 2 DNS Spoofing in a BadUSB Attack.pdf
ChatanBawankar
 
New syllabus entomology (Lession plan 121).pdf
New syllabus entomology (Lession plan 121).pdfNew syllabus entomology (Lession plan 121).pdf
New syllabus entomology (Lession plan 121).pdf
Arshad Shaikh
 
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdf
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdfTechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdf
TechSoup Microsoft Copilot Nonprofit Use Cases and Live Demo - 2025.05.28.pdf
TechSoup
 
What are the Features & Functions of Odoo 18 SMS Marketing
What are the Features & Functions of Odoo 18 SMS MarketingWhat are the Features & Functions of Odoo 18 SMS Marketing
What are the Features & Functions of Odoo 18 SMS Marketing
Celine George
 
Policies, procedures, subject selection and QTAC.pptx
Policies, procedures, subject selection and QTAC.pptxPolicies, procedures, subject selection and QTAC.pptx
Policies, procedures, subject selection and QTAC.pptx
mansk2
 
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptxQUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
Sourav Kr Podder
 
Drug Metabolism advanced medicinal chemistry.pptx
Drug Metabolism advanced medicinal chemistry.pptxDrug Metabolism advanced medicinal chemistry.pptx
Drug Metabolism advanced medicinal chemistry.pptx
pharmaworld
 
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase HughesThe Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
The Ellipsis Manual Analysis And Engineering Of Human Behavior Chase Hughes
pekokmupei
 
Research Handbook On Environment And Investment Law Kate Miles
Research Handbook On Environment And Investment Law Kate MilesResearch Handbook On Environment And Investment Law Kate Miles
Research Handbook On Environment And Investment Law Kate Miles
mucomousamir
 
QUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptx
QUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptxQUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptx
QUIZ-O-FORCE PRELIMINARY ANSWER SLIDE.pptx
Sourav Kr Podder
 
Philosophical Basis of Curriculum Designing
Philosophical Basis of Curriculum DesigningPhilosophical Basis of Curriculum Designing
Philosophical Basis of Curriculum Designing
Ankit Choudhary
 
EVALUATION AND MANAGEMENT OF OPEN FRACTURE
EVALUATION AND MANAGEMENT OF OPEN FRACTUREEVALUATION AND MANAGEMENT OF OPEN FRACTURE
EVALUATION AND MANAGEMENT OF OPEN FRACTURE
BipulBorthakur
 
the dynastic history of the Gahadwals of Early Medieval Period
the dynastic history of the Gahadwals of Early Medieval Periodthe dynastic history of the Gahadwals of Early Medieval Period
the dynastic history of the Gahadwals of Early Medieval Period
PrachiSontakke5
 
Education Funding Equity in North Carolina: Looking Beyond Income
Education Funding Equity in North Carolina: Looking Beyond IncomeEducation Funding Equity in North Carolina: Looking Beyond Income
Education Funding Equity in North Carolina: Looking Beyond Income
EducationNC
 

write Ocaml programe to add all numbers in a list the solution .pdf

  • 1. write Ocaml programe to add all numbers in a list ? the solution : let rec sum list = match list with [ ] -> 0 | x:: tail -> x + (sum tail);; let a = [2;4;5;6;1;9;10 ];; sum a;; question is :-Write a Ocaml Program to multiply each element in a list by 2. a= [2;4;5;6;1;9;10 ] Solution let rec intmult : int list * int -> int list = function ([],_) -> [0] | ([x] ,al) -> [x * al] | (x::xs,al) -> x * al :: intmult (xs, al);; Also, you can use the map function as I mentioned below, let intmult (l,m)= List.map (fun x -> x * m) l