Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
