Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write the code in ocamle languag 1) in ocaml language Write a function that takes a, b, and c and return a string of the
write the code in ocamle languag
return a string of the tree values in sorted order.
You might want to write a function combine a b c
that returns a contact ":" b contact ":" contact c.
You will use string_of_int function to convert int
to string.
sort_as_str 5 4 6;; return "4:5:6"
sort_as_str 4 6 5;; return "4:5:6"
sort_as_str 4 5 6;; return "4:5"6"
2) in ocaml define the following functions
abs a - returns the absolute value of a
inc a - returns a incremented by 1
dec a - returns b decremented by 1
let double a - returns a times 2
let triple a - returns a times 3
let half a - returns a divides by 2
What's the result for:
-2 |> double |> triple |> inc | half |> abs |> dec |> dec;
3) write a recursive function
divide a b that returns the value of a divide by b.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started