I do creat a program who converse a number (int) of base 10 to base 16,
But i don’t know how to check this !
My code :
`let base_16_aux(x : int) : string =
if x <= 15
then temp(x,"")
else let rec base_16_aux2(x : int) : string =
let (r, q) : int * int = mod16(x) in
let result : string = “” in
if q < 16
then temp(q, result)
else let (c, d) : string * int =
(temp(r , result), base_16_aux2(q))
First you should use the [code] block from discuss and indent your code so that structure appear more clearly:
let base_16_aux(x : int) : string =
if x <= 15
then
temp(x,"")
else
let rec base_16_aux2(x : int) : string =
let (r, q) : int * int = mod16(x) in
let result : string = "" in
if q < 16
then
temp(q, result)
else
let (c, d) : string * int =
(temp(r , result), base_16_aux2(q))
There are multiple issues with this program:
What is temp ?
Function application do not need parenthesis in OCaml, but maybe your temp function expects a couple ? Because (x, "") is a couple in OCaml, not a list of two function parameters.
You use let ... constructs inside expressions where only let ... in are allowed.